Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MIRI LRS spec3 regtest setup #8543

Merged
merged 2 commits into from
Jun 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions jwst/regtest/test_miri_lrs_slit_spec3.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,31 @@ def run_pipeline(rtdata_module, request):
Run the calwebb_spec3 pipeline on an ASN of nodded MIRI LRS
fixed-slit exposures using different options for the WCS and output
image shape for the resample step.

The first iteration ("default_wcs") creates an output WCS for the combined
product based on the built-in WCS's in the inputs.

The second iteration ("user_wcs") creates a user-supplied WCS input file
using the WCS from the default product, just to prove that you get the
identical result when using a user-supplied WCS.

The third iteration ("user_wcs+shape") uses the same user-supplied WCS and also
specifies the output 2D file shape, using a shape that is identical to the
default. Hence all of the first 3 iterations should produce identical results
and therefore are compared to a single set of truth files.

The fourth iteration ("user_wcs+shape1") uses the same user-specified WCS and
specifies an output 2D file shape that is 1 pixel larger than the default in
both axes. Hence the resulting s2d product needs a separate (larger) truth file.
Meanwhile, the x1d product from this iteration should still be identical to
the first 3, because the extra row and column of the 2D data file are ignored
during extraction.
"""
rtdata = rtdata_module

# Get the spec3 ASN and its members
rtdata.get_asn("miri/lrs/jw01530-o005_20221202t204827_spec3_00001_asn.json")
root_file = "jw01530-o005_t004_miri_p750l_"
rtdata.get_truth("truth/test_miri_lrs_slit_spec3/jw01530-o005_t004_miri_p750l_s2d.fits")

args = [
"calwebb_spec3",
Expand All @@ -36,9 +54,12 @@ def run_pipeline(rtdata_module, request):
rtdata.custom_wcs_mode = request.param

if request.param != "default_wcs":
dm = datamodels.open(rtdata.truth)
# Get the s2d product that was just created using "default_wcs"
default_s2d = root_file + "s2d.fits"
dm = datamodels.open(default_s2d)
# Create a user-supplied WCS file that is identical to the default WCS
af = asdf.AsdfFile({"wcs": dm.meta.wcs})
wcs_file = rtdata.truth[:-8] + 'wcs.asdf'
wcs_file = default_s2d[:-8] + 'wcs.asdf'
af.write_to(wcs_file)
args.append(f"--steps.resample_spec.output_wcs={wcs_file}")

Expand Down