Skip to content

Commit

Permalink
Test mag grad components on singular points
Browse files Browse the repository at this point in the history
Test if evaluation of the mag grad components on singular points return
nans.
  • Loading branch information
santisoler committed Oct 3, 2024
1 parent a6b70ac commit d1fa434
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions choclo/tests/test_prism_magnetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,19 @@ class TestMagneticFieldSingularities:
we approach from outside of the prism.
"""

COMPONENTS = (
magnetic_field,
magnetic_e,
magnetic_n,
magnetic_u,
magnetic_ee,
magnetic_en,
magnetic_eu,
magnetic_nn,
magnetic_nu,
magnetic_uu,
)

@pytest.fixture()
def sample_prism(self):
"""
Expand Down Expand Up @@ -752,9 +765,7 @@ def get_interior_points(self, prism):
coordinates = tuple(c.ravel() for c in np.meshgrid(easting, northing, upward))
return coordinates

@pytest.mark.parametrize(
"forward_func", (magnetic_field, magnetic_e, magnetic_n, magnetic_u)
)
@pytest.mark.parametrize("forward_func", COMPONENTS)
def test_on_vertices(self, sample_prism, forward_func):
"""
Test if magnetic field components on vertices are equal to NaN
Expand All @@ -767,9 +778,7 @@ def test_on_vertices(self, sample_prism, forward_func):
)
assert np.isnan(results).all()

@pytest.mark.parametrize(
"forward_func", (magnetic_field, magnetic_e, magnetic_n, magnetic_u)
)
@pytest.mark.parametrize("forward_func", COMPONENTS)
@pytest.mark.parametrize("direction", ("easting", "northing", "upward"))
def test_on_edges(self, sample_prism, direction, forward_func):
"""
Expand All @@ -785,9 +794,7 @@ def test_on_edges(self, sample_prism, direction, forward_func):
)
assert np.isnan(results).all()

@pytest.mark.parametrize(
"forward_func", (magnetic_field, magnetic_e, magnetic_n, magnetic_u)
)
@pytest.mark.parametrize("forward_func", COMPONENTS)
def test_on_interior_points(self, sample_prism, forward_func):
"""
Test if magnetic field components are NaN on internal points
Expand Down

0 comments on commit d1fa434

Please sign in to comment.