diff --git a/jwst/regtest/test_miri_image.py b/jwst/regtest/test_miri_image.py index 2d6f46061f..b6863eccec 100644 --- a/jwst/regtest/test_miri_image.py +++ b/jwst/regtest/test_miri_image.py @@ -32,6 +32,52 @@ def run_detector1(rtdata_module): Step.from_cmdline(args) +@pytest.fixture(scope="module") +def run_detector1_multiprocess_rate(rtdata_module): + """Run detector1 pipeline on MIRI imaging data.""" + rtdata = rtdata_module + rtdata.get_data("miri/image/jw01024001001_04101_00001_mirimage_uncal.fits") + + # Run detector1 pipeline only on one of the _uncal files + args = ["jwst.pipeline.Detector1Pipeline", rtdata.input, + "--save_calibrated_ramp=True", + "--steps.dq_init.save_results=True", + "--steps.saturation.save_results=True", + "--steps.firstframe.save_results=True", + "--steps.lastframe.save_results=True", + "--steps.reset.save_results=True", + "--steps.linearity.save_results=True", + "--steps.rscd.save_results=True", + "--steps.dark_current.save_results=True", + "--steps.refpix.save_results=True", + "--steps.ramp_fit.maximum_cores=2", # Multiprocessing + ] + Step.from_cmdline(args) + + +@pytest.fixture(scope="module") +def run_detector1_multiprocess_jump(rtdata_module): + """Run detector1 pipeline on MIRI imaging data.""" + rtdata = rtdata_module + rtdata.get_data("miri/image/jw01024001001_04101_00001_mirimage_uncal.fits") + + # Run detector1 pipeline only on one of the _uncal files + args = ["jwst.pipeline.Detector1Pipeline", rtdata.input, + "--save_calibrated_ramp=True", + "--steps.dq_init.save_results=True", + "--steps.saturation.save_results=True", + "--steps.firstframe.save_results=True", + "--steps.lastframe.save_results=True", + "--steps.reset.save_results=True", + "--steps.linearity.save_results=True", + "--steps.rscd.save_results=True", + "--steps.dark_current.save_results=True", + "--steps.refpix.save_results=True", + "--steps.jump.maximum_cores=2", # Multiprocessing + ] + Step.from_cmdline(args) + + @pytest.fixture(scope="module") def run_detector1_with_average_dark_current(rtdata_module): """Run detector1 pipeline on MIRI imaging data, providing an @@ -115,6 +161,18 @@ def test_miri_image_detector1(run_detector1, rtdata_module, fitsdiff_default_kwa _assert_is_same(rtdata_module, fitsdiff_default_kwargs, suffix) +@pytest.mark.bigdata +def test_miri_image_detector1_multiprocess_rate(run_detector1_multiprocess_rate, rtdata_module, fitsdiff_default_kwargs): + """Regression test of detector1 pipeline performed on MIRI imaging data.""" + _assert_is_same(rtdata_module, fitsdiff_default_kwargs, "rate") + + +@pytest.mark.bigdata +def test_miri_image_detector1_multiprocess_jump(run_detector1_multiprocess_jump, rtdata_module, fitsdiff_default_kwargs): + """Regression test of detector1 pipeline performed on MIRI imaging data.""" + _assert_is_same(rtdata_module, fitsdiff_default_kwargs, "rate") + + @pytest.mark.bigdata def test_detector1_mem_usage(rtdata_module): """Determine the memory usage for Detector 1""" diff --git a/jwst/regtest/test_niriss_image.py b/jwst/regtest/test_niriss_image.py index cf07ae16df..be31fbda67 100644 --- a/jwst/regtest/test_niriss_image.py +++ b/jwst/regtest/test_niriss_image.py @@ -36,6 +36,84 @@ def run_detector1(rtdata_module): Step.from_cmdline(args) +@pytest.fixture(scope="module") +def run_detector1_multiprocess_rate(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_multiprocess_rate_save_opt(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 + "--steps.ramp_fit.save_opt=True", + "--steps.ramp_fit.opt_name=jw01094001002_02107_00001_nis.fits", + ] + + Step.from_cmdline(args) + + +@pytest.fixture(scope="module") +def run_detector1_multiprocess_jump(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.jump.maximum_cores=2", # Multiprocessing + "--steps.ramp_fit.skip=True", + ] + + Step.from_cmdline(args) + + @pytest.fixture(scope="module") def run_detector1_with_clean_flicker_noise(rtdata_module): """Run detector1 pipeline on NIRISS imaging data with noise cleaning.""" @@ -67,6 +145,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", @@ -110,6 +189,43 @@ def test_niriss_tweakreg_no_sources(rtdata, fitsdiff_default_kwargs): result.shelve(model, modify=False) +@pytest.mark.bigdata +def test_niriss_image_detector1_multiprocess_rate( + run_detector1_multiprocess_rate, 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) + + +@pytest.mark.bigdata +@pytest.mark.parametrize("suffix", ["rate", "fitopt"]) +def test_niriss_image_detector1_multiprocess_rate_save_opt( + run_detector1_multiprocess_rate_save_opt, rtdata_module, fitsdiff_default_kwargs, suffix): + """ + Runs test_niriss_image_detector1[rate], but with ramp fitting run with multiprocessing + on two processors and the optional results product. + """ + truth_dir = 'test_niriss_image' + # fitsdiff_default_kwargs["numdiffs"] = 10 + _assert_is_same(rtdata_module, fitsdiff_default_kwargs, suffix, truth_dir) + + +@pytest.mark.bigdata +def test_niriss_image_detector1_multiprocess_jump( + run_detector1_multiprocess_jump, 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, "jump", truth_dir) + + def _assert_is_same(rtdata_module, fitsdiff_default_kwargs, suffix, truth_dir): """Assertion helper for the above tests""" rtdata = rtdata_module