Skip to content

Commit

Permalink
Add test coverage for Weight.__iadd__
Browse files Browse the repository at this point in the history
  • Loading branch information
landreman committed Oct 12, 2024
1 parent bfc3ddd commit 3e266ea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/simsopt/field/selffield.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
This module contains functions for computing the self-field of a coil using the
method from Hurwitz, Landreman, & Antonsen, arXiv (2023).
methods from Hurwitz, Landreman, & Antonsen, arXiv:2310.09313 (2023) and
Landreman, Hurwitz, & Antonsen, arXiv:2310.12087 (2023).
"""

from scipy import constants
Expand Down
7 changes: 6 additions & 1 deletion tests/core/test_derivative.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def test_scaled_optimizable_operator(self):
"""
Confirm that values and derivatives behave correctly when an
Optimizable object is scaled by a constant, overloading the *
operator.
and + operators.
"""
opt1a = Opt(n=2)
opt1b = Opt(n=5)
Expand All @@ -179,6 +179,11 @@ def test_scaled_optimizable_operator(self):
taylor_test(obj3)
np.testing.assert_allclose(obj3.J(), 3*factor * obj1.J())
np.testing.assert_allclose(obj3.dJ(), 3*factor * obj1.dJ())
shift = 46.2
w += shift
taylor_test(obj3)
np.testing.assert_allclose(obj3.J(), (3*factor + shift) * obj1.J())
np.testing.assert_allclose(obj3.dJ(), (3*factor + shift) * obj1.dJ())

def test_optimizable_sum(self):
"""
Expand Down

0 comments on commit 3e266ea

Please sign in to comment.