Skip to content

Commit

Permalink
Cover precomps = None case in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-graham committed Dec 13, 2024
1 parent 8b1c798 commit be0cf52
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions tests/test_spherical_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
@pytest.mark.parametrize("method", method_to_test)
@pytest.mark.parametrize("reality", reality_to_test)
@pytest.mark.parametrize("spmd", multiple_gpus)
@pytest.mark.parametrize("use_generate_precomputes", [True, False])
@pytest.mark.filterwarnings("ignore::RuntimeWarning")
def test_transform_inverse(
flm_generator,
Expand All @@ -37,6 +38,7 @@ def test_transform_inverse(
method: str,
reality: bool,
spmd: bool,
use_generate_precomputes: bool,
):
if reality and spin != 0:
pytest.skip("Reality only valid for scalar fields (spin=0).")
Expand All @@ -52,7 +54,10 @@ def test_transform_inverse(
Reality=reality,
)

precomps = generate_precomputes(L, spin, sampling, L_lower=L_lower)
if use_generate_precomputes:
precomps = generate_precomputes(L, spin, sampling, L_lower=L_lower)
else:
precomps = None
f = spherical.inverse(
flm,
L,
Expand Down Expand Up @@ -106,6 +111,7 @@ def test_transform_inverse_healpix(
@pytest.mark.parametrize("method", method_to_test)
@pytest.mark.parametrize("reality", reality_to_test)
@pytest.mark.parametrize("spmd", multiple_gpus)
@pytest.mark.parametrize("use_generate_precomputes", [True, False])
@pytest.mark.filterwarnings("ignore::RuntimeWarning")
def test_transform_forward(
flm_generator,
Expand All @@ -116,6 +122,7 @@ def test_transform_forward(
method: str,
reality: bool,
spmd: bool,
use_generate_precomputes: bool,
):
if reality and spin != 0:
pytest.skip("Reality only valid for scalar fields (spin=0).")
Expand All @@ -131,8 +138,10 @@ def test_transform_forward(
Spin=spin,
Reality=reality,
)

precomps = generate_precomputes(L, spin, sampling, None, True, L_lower)
if use_generate_precomputes:
precomps = generate_precomputes(L, spin, sampling, None, True, L_lower)
else:
precomps = None
flm_check = spherical.forward(
f,
L,
Expand Down

0 comments on commit be0cf52

Please sign in to comment.