I thought we had fixed this before #1456 but I guess not?
from desc.coils import FourierPlanarCoil
from desc.objectives import ObjectiveFunction, CoilLength
from desc.optimize import Optimizer
coil = FourierPlanarCoil(normal=[0,0,1])
opt = Optimizer("lsq-exact")
obj = ObjectiveFunction(CoilLength(coil))
# Works fine, no Nan
opt.optimize(coil,objective=obj,verbose=3,maxiter=2);
coil = FourierPlanarCoil(normal=[1e-18,1e-18,1])
opt = Optimizer("lsq-exact")
obj = ObjectiveFunction(CoilLength(coil))
# Nan Optimality when normal is close but not quite vertical
opt.optimize(coil,objective=obj,verbose=3,maxiter=2);
- No NaN in forward mode
- No NaN if the normal is [2e-8, 2e-8, 1], but NaN when the first two components are anything less than 2e-8
- points to handling of the allclose here which depends on the dotproduct I guess? though these are not aligned with negative Z axis...
Our current tests dont catch this, if I add
test([0, 1e-8, 1]) # nearly parallel
test([0, 1e-8, -1]) # nearly antiparallel
to our test for this, these fail.
I thought we had fixed this before #1456 but I guess not?
Our current tests dont catch this, if I add
to our test for this, these fail.