Skip to content
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

CoilSet of SplineXYZCoil with different knots can give wrong values #1136

Closed
f0uriest opened this issue Jul 19, 2024 · 1 comment · Fixed by #1142
Closed

CoilSet of SplineXYZCoil with different knots can give wrong values #1136

f0uriest opened this issue Jul 19, 2024 · 1 comment · Fixed by #1142
Assignees

Comments

@f0uriest
Copy link
Member

f0uriest commented Jul 19, 2024

I think there might be an issue with CoilSets 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 and intervals back to params instead of transforms (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 that knots and intervals are the same for all SplineXYZCoil in a CoilSet

Originally posted by @f0uriest in #970 (review)

Confirmed this is an issue on master:

coil = FourierPlanarCoil(1e6)
coil1 = coil.to_SplineXYZ(knots=2*np.pi*np.linspace(0,1,5))
coil2 = coil.to_SplineXYZ(knots=2*np.pi*np.linspace(0,1,5)**4)
coilset = CoilSet(coil1, coil2)
B = coilset.compute_magnetic_field(np.array([10, 1, 1]))
B12 = coil1.compute_magnetic_field(np.array([10, 1, 1])) + coil2.compute_magnetic_field(np.array([10, 1, 1]))
np.testing.assert_allclose(B,B12)
@dpanici
Copy link
Collaborator

dpanici commented Jul 23, 2024

@kianorr I vote the 2nd approach

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants