Skip to content

Commit

Permalink
Add test for multiprocessing of model with components featuring inner…
Browse files Browse the repository at this point in the history
… radial cutoffs
  • Loading branch information
MetinSa committed Mar 21, 2024
1 parent 795e837 commit 9e8c211
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion tests/test_get_emission.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ def test_invalid_pixel(
obs=observer,
)


def test_multiprocessing() -> None:
"""
Testing that model with multiprocessing enabled returns the same value as
Expand Down Expand Up @@ -331,6 +330,35 @@ def test_multiprocessing() -> None:

assert np.allclose(emission_binned_ang.value, emission_binned_ang_parallel.value)

def test_inner_radial_cutoff_multiprocessing() -> None:
"""
Testing that model with inner radial cutoffs can be parallelized.
"""

model = Zodipy("RRM-experimental")
model_parallel = Zodipy("RRM-experimental", n_proc=4)

observer = "earth"
time = Time("2020-01-01")
frequency = 78 * u.micron
nside = 32
pix = np.random.randint(0, hp.nside2npix(nside), size=1000)

emission_pix = model.get_emission_pix(
frequency,
pixels=pix,
nside=nside,
obs_time=time,
obs=observer,
)
emission_pix_parallel = model_parallel.get_emission_pix(
frequency,
pixels=pix,
nside=nside,
obs_time=time,
obs=observer,
)
assert np.allclose(emission_pix, emission_pix_parallel)

@given(
model(extrapolate=True),
Expand Down

0 comments on commit 9e8c211

Please sign in to comment.