-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update FGS guider data, add image3 test
- Loading branch information
1 parent
17b7133
commit 19cdcda
Showing
2 changed files
with
72 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import pytest | ||
from astropy.io.fits.diff import FITSDiff | ||
|
||
from jwst.resample.resample import OutputTooLargeError | ||
from jwst.stpipe import Step | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def run_fgs_image3(rtdata_module): | ||
rtdata = rtdata_module | ||
rtdata.get_asn('fgs/image3/jw01029-o001_20240716t172128_image3_00001_asn.json') | ||
|
||
args = ["calwebb_image3", rtdata.input] | ||
Step.from_cmdline(args) | ||
|
||
|
||
@pytest.mark.bigdata | ||
@pytest.mark.parametrize("suffix", ['i2d', 'segm']) | ||
def test_fgs_image3(run_fgs_image3, rtdata_module, fitsdiff_default_kwargs, suffix): | ||
"""Regression test for FGS data in the image3 pipeline""" | ||
rtdata = rtdata_module | ||
output = f"jw01029-o001_t009_fgs_clear_{suffix}.fits" | ||
rtdata.output = output | ||
|
||
rtdata.get_truth(f"truth/test_fgs_image3/{output}") | ||
|
||
# Adjust tolerance for machine precision with float32 drizzle code | ||
if suffix == "i2d": | ||
fitsdiff_default_kwargs["rtol"] = 3e-3 | ||
fitsdiff_default_kwargs["atol"] = 2e-2 | ||
|
||
diff = FITSDiff(rtdata.output, rtdata.truth, **fitsdiff_default_kwargs) | ||
assert diff.identical, diff.report() | ||
|
||
|
||
@pytest.mark.bigdata | ||
def test_fgs_image3_catalog(run_fgs_image3, rtdata_module, diff_astropy_tables): | ||
rtdata = rtdata_module | ||
rtdata.output = "jw01029-o001_t009_fgs_clear_cat.ecsv" | ||
rtdata.get_truth("truth/test_fgs_image3/jw01029-o001_t009_fgs_clear_cat.ecsv") | ||
|
||
assert diff_astropy_tables(rtdata.output, rtdata.truth, rtol=1e-3, atol=1e-4) | ||
|
||
|
||
@pytest.mark.bigdata | ||
def test_fgs_toobig(rtdata, fitsdiff_default_kwargs, caplog, monkeypatch): | ||
"""Test for the situation where the combined mosaic is too large""" | ||
|
||
# Set the environment to not allow the resultant too-large image. | ||
# Note: this test was originally run on two pre-flight images | ||
# with WCSs from very different parts of the sky. | ||
# This condition should hopefully never be encountered in reductions | ||
# of in-flight data. To test the software failsafe, we now use real data | ||
# that makes a reasonable sized mosaic, but set the allowed memory to a | ||
# small value. | ||
monkeypatch.setenv('DMODEL_ALLOWED_MEMORY', "0.0001") | ||
|
||
rtdata.get_asn('fgs/image3/jw01029-o001_20240716t172128_image3_00001_asn.json') | ||
|
||
args = ['jwst.resample.ResampleStep', rtdata.input] | ||
with pytest.raises(OutputTooLargeError): | ||
Step.from_cmdline(args) |