-
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
C0 coils with splines #970
base: master
Are you sure you want to change the base?
Conversation
- also added to compute function for each interval - didn't add for all compute functions yet
| benchmark_name | dt(%) | dt(s) | t_new(s) | t_old(s) |
| -------------------------------------- | ---------------------- | ---------------------- | ---------------------- | ---------------------- |
test_build_transform_fft_lowres | +3.41 +/- 6.95 | +1.77e-02 +/- 3.61e-02 | 5.38e-01 +/- 3.4e-02 | 5.20e-01 +/- 1.2e-02 |
test_build_transform_fft_midres | +3.77 +/- 6.87 | +2.28e-02 +/- 4.15e-02 | 6.27e-01 +/- 3.4e-02 | 6.04e-01 +/- 2.4e-02 |
test_build_transform_fft_highres | +1.32 +/- 5.00 | +1.33e-02 +/- 5.03e-02 | 1.02e+00 +/- 3.9e-02 | 1.01e+00 +/- 3.2e-02 |
test_equilibrium_init_lowres | +5.62 +/- 5.84 | +2.17e-01 +/- 2.26e-01 | 4.09e+00 +/- 2.0e-01 | 3.87e+00 +/- 1.1e-01 |
test_equilibrium_init_medres | +4.43 +/- 6.27 | +1.87e-01 +/- 2.65e-01 | 4.41e+00 +/- 1.8e-01 | 4.22e+00 +/- 2.0e-01 |
test_equilibrium_init_highres | +2.12 +/- 5.26 | +1.18e-01 +/- 2.92e-01 | 5.67e+00 +/- 2.0e-01 | 5.55e+00 +/- 2.1e-01 |
test_objective_compile_dshape_current | +3.76 +/- 2.82 | +1.45e-01 +/- 1.08e-01 | 3.99e+00 +/- 7.2e-02 | 3.85e+00 +/- 8.1e-02 |
test_objective_compile_atf | -1.70 +/- 2.63 | -1.38e-01 +/- 2.13e-01 | 7.96e+00 +/- 1.1e-01 | 8.10e+00 +/- 1.8e-01 |
test_objective_compute_dshape_current | -0.54 +/- 1.98 | -1.85e-05 +/- 6.85e-05 | 3.44e-03 +/- 5.6e-05 | 3.45e-03 +/- 3.9e-05 |
test_objective_compute_atf | -0.47 +/- 2.20 | -4.76e-05 +/- 2.25e-04 | 1.02e-02 +/- 1.3e-04 | 1.02e-02 +/- 1.9e-04 |
test_objective_jac_dshape_current | +0.83 +/- 9.98 | +3.28e-04 +/- 3.93e-03 | 3.97e-02 +/- 1.7e-03 | 3.94e-02 +/- 3.5e-03 |
test_objective_jac_atf | -5.65 +/- 2.59 | -1.12e-01 +/- 5.12e-02 | 1.87e+00 +/- 3.0e-02 | 1.98e+00 +/- 4.1e-02 |
test_perturb_1 | -1.31 +/- 3.62 | -1.63e-01 +/- 4.50e-01 | 1.23e+01 +/- 3.0e-01 | 1.24e+01 +/- 3.4e-01 |
test_perturb_2 | -3.01 +/- 2.78 | -5.46e-01 +/- 5.05e-01 | 1.76e+01 +/- 4.5e-01 | 1.81e+01 +/- 2.3e-01 |
test_proximal_jac_atf | -0.38 +/- 1.16 | -3.07e-02 +/- 9.46e-02 | 8.12e+00 +/- 6.5e-02 | 8.15e+00 +/- 6.9e-02 |
test_proximal_freeb_compute | -0.34 +/- 1.25 | -6.19e-04 +/- 2.29e-03 | 1.82e-01 +/- 1.6e-03 | 1.83e-01 +/- 1.6e-03 |
test_proximal_freeb_jac | -0.79 +/- 1.49 | -5.93e-02 +/- 1.12e-01 | 7.42e+00 +/- 1.0e-01 | 7.48e+00 +/- 3.8e-02 |
test_solve_fixed_iter | -0.82 +/- 61.37 | -4.16e-02 +/- 3.10e+00 | 5.01e+00 +/- 2.2e+00 | 5.05e+00 +/- 2.2e+00 | |
- added equal signs to ranges - used jnp.where instead of directly slicing
… into ko/discon_curve
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #970 +/- ##
==========================================
+ Coverage 95.33% 95.36% +0.02%
==========================================
Files 90 90
Lines 22643 22741 +98
==========================================
+ Hits 21586 21686 +100
+ Misses 1057 1055 -2
|
- now works for batch arrays - interpolate over whole array
… into ko/discon_curve
- use ifor_loop - delete double stack - use jnp.where for istop
- add is_discontinuous - use [[]] as default indices
- still have to do it for the others
… into ko/discon_curve
|
accidentally used full_f[istop], which just returned the last array, instead of full_f[:, istop]
when N = 1000 then the test fails for cubic and curvature(I think due to the differences within 2 knots for cubic interp)
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.
I think there might be an issue with CoilSet
s if there are spline curves that have different breakpoints. We only vmap over params, not transforms, since its assumed that every coil in a CoilSet
can use the same transforms. I think this is also an issue if they have different knots after #1099
Possible fixes:
- move
knots
andintervals
back toparams
instead oftransforms
(not sure if this will work, what was the reason they were moved in the first place?) - Add logic to
desc.coils._check_type
to ensure thatknots
andintervals
are the same for allSplineXYZCoil
in aCoilSet
I thought knots and intervals couldn't be in params because they're not optimizable? |
istop = jnp.where(istop == 0, -1, istop) | ||
|
||
# fill f values outside of interval with break point values so that | ||
# interpolation only takes into consideration the interval |
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.
Should note somewhere (maybe in a docstring) that the BC for a given spline is not enforced at the end of each interval but rather at the end of the 0 -> 2pi interval in s
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.
- some docstring changes requested,
- the
basis
kwarg is deprecated now, the compute functions should always return things inrpz
(per Move basis change to main compute function #1027 ) - since
intervals
is a new attribute ofSplineXYZCurve
/Coil
, make sure in eitherset_up
or wherever it needs to be (If forget exactly, search for like_rho
or whatever for aFourierRZTorioidalSurface
orrotmat
for aCurve
object, we do this for those), thatintervals
gets set to the correct value so that loading in oldSplineXYZ
objects does not cause issues wherecoil.intervals
does not exist (just set toNone
is the thing to do)
test("linear", "torsion", compare_breaks=False) | ||
|
||
test("cubic", "length") | ||
# don't include break points because of interpolator BCs |
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.
re-think of why this fails, probably not due to the BC but the fact that the BC of the interval (besides at 0 and 2pi) is determined by whatever the spline does when it encounters the flat regions at the edges of the specific interval being considered
conflicts in coils.py and curve.py
check if evaluating a single point at the halfway pt yields the same error as the full grid evaluation |
Add discontinuous knots for C0 capabilities.