|
| 1 | +"""Regression test for WFSS contam correction of NIRISS data""" |
| 2 | + |
| 3 | +import pytest |
| 4 | + |
| 5 | +from jwst.regtest import regtestdata as rt |
| 6 | + |
| 7 | +# Mark all tests in this module |
| 8 | +pytestmark = [pytest.mark.bigdata] |
| 9 | + |
| 10 | + |
| 11 | +@pytest.fixture(scope="module") |
| 12 | +def run_wfss_contam(rtdata_module, resource_tracker): |
| 13 | + """Run the wfss_contam step""" |
| 14 | + rtdata = rtdata_module |
| 15 | + |
| 16 | + # Get input data files |
| 17 | + rtdata.get_data("niriss/wfss/jw02738-o001_t001_niriss_clear-f200w_i2d.fits") |
| 18 | + rtdata.get_data("niriss/wfss/jw02738-o001_t001_niriss_clear-f200w_segm.fits") |
| 19 | + rtdata.get_data("niriss/wfss/jw02738-o001_t001_niriss_clear-f200w_cat.ecsv") |
| 20 | + rtdata.get_data("niriss/wfss/jw02738001001_04201_00004_nis_srctype.fits") |
| 21 | + |
| 22 | + # Run the step |
| 23 | + step_params = { |
| 24 | + "step": "jwst.wfss_contam.WfssContamStep", |
| 25 | + "args": [ |
| 26 | + "--save_simulated_image=True", |
| 27 | + "--save_contam_images=True", |
| 28 | + "--skip=False", |
| 29 | + ], |
| 30 | + } |
| 31 | + with resource_tracker.track(): |
| 32 | + rtdata = rt.run_step_from_dict(rtdata, **step_params) |
| 33 | + return rtdata |
| 34 | + |
| 35 | + |
| 36 | +def test_log_tracked_resources_tsimg(log_tracked_resources, run_wfss_contam): |
| 37 | + log_tracked_resources() |
| 38 | + |
| 39 | + |
| 40 | +@pytest.mark.parametrize("suffix", ["simul", "simul_slits", "contam", "wfsscontamstep"]) |
| 41 | +def test_niriss_wfss_contam(run_wfss_contam, fitsdiff_default_kwargs, suffix): |
| 42 | + """Regression test for wfss_contam applied to NIRISS WFSS data""" |
| 43 | + rt.is_like_truth( |
| 44 | + run_wfss_contam, fitsdiff_default_kwargs, suffix, "truth/test_niriss_wfss_contam" |
| 45 | + ) |
0 commit comments