Skip to content

Commit

Permalink
Regression test for JP-3604 (#8477)
Browse files Browse the repository at this point in the history
  • Loading branch information
nden committed May 15, 2024
1 parent 8b254ae commit 3df35ef
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ tweakreg
- Changed default settings for ``abs_separation`` parameter for the ``tweakreg``
step to have a value compatible with the ``abs_tolerance`` parameter. [#8445]

- Improve error handling in the absolute alignment. [#8450]
- Improve error handling in the absolute alignment. [#8450, #8477]

wfss_contam
-----------
Expand Down
25 changes: 25 additions & 0 deletions jwst/regtest/test_niriss_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
import pytest
from astropy.io.fits.diff import FITSDiff

from jwst import datamodels
from jwst.stpipe import Step
from jwst.tweakreg import TweakRegStep


@pytest.fixture(scope="module")
Expand Down Expand Up @@ -44,6 +46,29 @@ def test_niriss_image_detector1(run_detector1, rtdata_module, fitsdiff_default_k
_assert_is_same(rtdata_module, fitsdiff_default_kwargs, suffix)


@pytest.mark.bigdata
def test_niriss_tweakreg_no_sources(rtdata, fitsdiff_default_kwargs):
"""Make sure tweakreg is skipped when sources are not found.
"""

rtdata.input = "niriss/imaging/jw01537-o003_20240406t164421_image3_00004_asn.json"
rtdata.get_asn("niriss/imaging/jw01537-o003_20240406t164421_image3_00004_asn.json")

args = ["jwst.tweakreg.TweakRegStep", rtdata.input, "--abs_refcat='GAIADR3'"]
result = Step.from_cmdline(args)
# Check that the step is skipped
assert result.skip

# Check the status of the step is set correctly in the files.
result = TweakRegStep.call(rtdata.input)

for fi in result._models:
with datamodels.open(fi) as model:
assert model.meta.cal_step.tweakreg == 'SKIPPED'

result.close()


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

0 comments on commit 3df35ef

Please sign in to comment.