Skip to content

Commit

Permalink
Adding ramp fit multiprocessing regression test.
Browse files Browse the repository at this point in the history
  • Loading branch information
kmacdonald-stsci committed Oct 28, 2024
1 parent 232d264 commit 3109ad9
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions jwst/regtest/test_niriss_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from jwst import datamodels
from jwst.stpipe import Step
from jwst.tweakreg import TweakRegStep
from jwst.ramp_fitting.ramp_fit_step import RampFitStep


@pytest.fixture(scope="module")
Expand All @@ -35,6 +36,30 @@ def run_detector1(rtdata_module):

Step.from_cmdline(args)

@pytest.fixture(scope="module")
def run_detector1_multi(rtdata_module):
"""Run calwebb_detector1 pipeline on NIRISS imaging data."""
rtdata = rtdata_module

rtdata.get_data("niriss/imaging/jw01094001002_02107_00001_nis_uncal.fits")

# Run detector1 pipeline on an _uncal files
args = ["calwebb_detector1", rtdata.input,
"--steps.persistence.save_trapsfilled=False",
"--steps.dq_init.save_results=True",
"--steps.saturation.save_results=True",
"--steps.superbias.save_results=True",
"--steps.refpix.save_results=True",
"--steps.linearity.save_results=True",
"--steps.dark_current.save_results=True",
"--steps.charge_migration.skip=False",
"--steps.charge_migration.save_results=True",
"--steps.jump.save_results=True",
"--steps.ramp_fit.maximum_cores=2", # Multiprocessing
]

Step.from_cmdline(args)


@pytest.fixture(scope="module")
def run_detector1_with_clean_flicker_noise(rtdata_module):
Expand Down Expand Up @@ -67,6 +92,7 @@ def test_niriss_image_detector1(run_detector1, rtdata_module, fitsdiff_default_k
_assert_is_same(rtdata_module, fitsdiff_default_kwargs, suffix, truth_dir)



@pytest.mark.bigdata
@pytest.mark.parametrize("suffix", ["cfn_clean_flicker_noise", "mask",
"flicker_bkg", "flicker_noise",
Expand Down Expand Up @@ -110,6 +136,17 @@ def test_niriss_tweakreg_no_sources(rtdata, fitsdiff_default_kwargs):
result.shelve(model, modify=False)


def test_niriss_image_detector1_multi(
run_detector1_multi, rtdata_module, fitsdiff_default_kwargs):
"""
Runs test_niriss_image_detector1[rate], but with ramp fitting run with multiprocessing
on two processors.
"""
truth_dir = 'test_niriss_image'
# fitsdiff_default_kwargs["numdiffs"] = 10
_assert_is_same(rtdata_module, fitsdiff_default_kwargs, "rate", truth_dir)


def _assert_is_same(rtdata_module, fitsdiff_default_kwargs, suffix, truth_dir):
"""Assertion helper for the above tests"""
rtdata = rtdata_module
Expand Down

0 comments on commit 3109ad9

Please sign in to comment.