-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
from_values
method for FourierRZCoil
and FourierPlanarCoil
#1116
Conversation
| benchmark_name | dt(%) | dt(s) | t_new(s) | t_old(s) |
| -------------------------------------- | ---------------------- | ---------------------- | ---------------------- | ---------------------- |
test_build_transform_fft_lowres | -1.31 +/- 6.92 | -6.88e-03 +/- 3.64e-02 | 5.19e-01 +/- 3.2e-02 | 5.26e-01 +/- 1.7e-02 |
test_build_transform_fft_midres | -0.87 +/- 2.97 | -5.22e-03 +/- 1.79e-02 | 5.97e-01 +/- 1.1e-02 | 6.02e-01 +/- 1.4e-02 |
test_build_transform_fft_highres | -0.18 +/- 3.20 | -1.82e-03 +/- 3.17e-02 | 9.87e-01 +/- 2.6e-02 | 9.89e-01 +/- 1.9e-02 |
test_equilibrium_init_lowres | +0.42 +/- 5.43 | +1.57e-02 +/- 2.02e-01 | 3.73e+00 +/- 1.4e-01 | 3.72e+00 +/- 1.4e-01 |
test_equilibrium_init_medres | +0.18 +/- 4.06 | +7.58e-03 +/- 1.70e-01 | 4.20e+00 +/- 1.2e-01 | 4.20e+00 +/- 1.2e-01 |
test_equilibrium_init_highres | -0.47 +/- 1.59 | -2.62e-02 +/- 8.89e-02 | 5.55e+00 +/- 6.1e-02 | 5.57e+00 +/- 6.4e-02 |
test_objective_compile_dshape_current | -0.13 +/- 1.16 | -5.23e-03 +/- 4.50e-02 | 3.88e+00 +/- 3.3e-02 | 3.88e+00 +/- 3.1e-02 |
test_objective_compile_atf | +0.01 +/- 1.54 | +6.10e-04 +/- 1.30e-01 | 8.43e+00 +/- 7.9e-02 | 8.43e+00 +/- 1.0e-01 |
test_objective_compute_dshape_current | -0.19 +/- 2.92 | -2.41e-06 +/- 3.66e-05 | 1.25e-03 +/- 2.5e-05 | 1.25e-03 +/- 2.7e-05 |
test_objective_compute_atf | +0.49 +/- 5.41 | +2.07e-05 +/- 2.28e-04 | 4.24e-03 +/- 1.2e-04 | 4.22e-03 +/- 2.0e-04 |
test_objective_jac_dshape_current | -7.70 +/- 8.15 | -3.01e-03 +/- 3.18e-03 | 3.61e-02 +/- 2.5e-03 | 3.91e-02 +/- 1.9e-03 |
test_objective_jac_atf | +3.70 +/- 3.35 | +6.85e-02 +/- 6.19e-02 | 1.92e+00 +/- 4.2e-02 | 1.85e+00 +/- 4.5e-02 |
test_perturb_1 | -0.55 +/- 1.07 | -7.68e-02 +/- 1.48e-01 | 1.38e+01 +/- 1.3e-01 | 1.38e+01 +/- 7.8e-02 |
test_perturb_2 | +0.12 +/- 1.38 | +2.26e-02 +/- 2.58e-01 | 1.88e+01 +/- 1.9e-01 | 1.87e+01 +/- 1.7e-01 |
test_proximal_jac_atf | -0.10 +/- 1.28 | -7.30e-03 +/- 9.42e-02 | 7.37e+00 +/- 6.5e-02 | 7.38e+00 +/- 6.8e-02 |
test_proximal_freeb_compute | +0.33 +/- 0.91 | +6.00e-04 +/- 1.63e-03 | 1.81e-01 +/- 1.1e-03 | 1.80e-01 +/- 1.2e-03 |
test_proximal_freeb_jac | +0.02 +/- 1.01 | +1.83e-03 +/- 7.50e-02 | 7.40e+00 +/- 4.4e-02 | 7.40e+00 +/- 6.1e-02 |
test_solve_fixed_iter | +0.41 +/- 6.29 | +7.44e-02 +/- 1.14e+00 | 1.82e+01 +/- 8.5e-01 | 1.82e+01 +/- 7.7e-01 | |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1116 +/- ##
==========================================
+ Coverage 95.26% 95.30% +0.04%
==========================================
Files 87 87
Lines 22089 22154 +65
==========================================
+ Hits 21042 21113 +71
+ Misses 1047 1041 -6
|
…maControl/DESC into dp/hotfix-fourierrzcoil-from-values
FourierRZcoil.from_values
Methodfrom_values
method for FourierRZCoil
and FourierPlanarCoil
desc/geometry/curve.py
Outdated
warnif( | ||
np.max(np.abs(coords[:, 2])) > 1e-14, # check that Z=0 for all points | ||
UserWarning, | ||
"Curve values are not planar!", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might want to give more info here, ie it still tries a least squares fit? or it takes the projection of the curve into a plane?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It takes the projection into a plane. And now that I made your other requested change about using the average normal vector, that plane is the "best fit" in some sense.
tests/test_coils.py
Outdated
@@ -204,13 +204,27 @@ def test_adding_MagneticField_with_Coil_or_CoilSet(self): | |||
def test_converting_coil_types(self): | |||
"""Test conversions between coil representations.""" | |||
s = np.linspace(0, 2 * np.pi, 100, endpoint=False) | |||
coil1 = FourierRZCoil(1e6, [0, 10, 2], [-2, 0, 0]) | |||
coil1 = FourierRZCoil(1e6, [0, 10, 0], [0, 0, 0]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The FourierPlanarCoil
fails to fit the FourierRZCoil
well if I make the n=1 component of it anything but zero... this seems like something it should be able to do with sufficient resolution? Maybe I messed something up in the fitting?
…maControl/DESC into dp/hotfix-fourierrzcoil-from-values
@dpanici I think it's fine, it's just different curve parameter definitions. Plotting them all they're on top of each other (this was using the default grid without endpoint): |
These are methods that we forgot to add to #1116. It might also be worth adding an option to `CoilSet.from_makegrid_coilfile` so that the coil set can be loaded as any type, instead of always using `SplineXYZCoil`. But at least now we can load the spline coils and then convert to any other coil type.
from_values
method that was present inFourierRZCurve
but missing inFourierRZCoil
from_values
method forFourierPlanarCurve
andFourierPlanarCoil
Resolves #1097