Skip to content

Commit

Permalink
JP-3150: skip extract1d for NIRISS SOSS data in F277W filter (#8275)
Browse files Browse the repository at this point in the history
Co-authored-by: Howard Bushouse <[email protected]>
  • Loading branch information
emolter and hbushouse authored Apr 11, 2024
1 parent ffc3567 commit bc3274a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ documentation
extract_1d
----------

- Added a hook to bypass the ``extract_1d`` step for NIRISS SOSS data in
the F277W filter with warning. [#8275]

- Replaced deprecated ``np.trapz`` with ``np.trapezoid()``. [#8415]

general
Expand Down
6 changes: 2 additions & 4 deletions jwst/extract_1d/extract_1d_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,11 +398,9 @@ def process(self, input):
if input_model.meta.instrument.filter == 'CLEAR':
self.log.info('Exposure is through the GR700XD + CLEAR (science).')
soss_filter = 'CLEAR'
elif input_model.meta.instrument.filter == 'F277W':
self.log.info('Exposure is through the GR700XD + F277W (calibration).')
soss_filter = 'F277W'
else:
self.log.error('The SOSS extraction is implemented for the CLEAR or F277W filters only.')
self.log.error('The SOSS extraction is implemented for the CLEAR filter only.'
f'Requested filter is {input_model.meta.instrument.filter}.')
self.log.error('extract_1d will be skipped.')
input_model.meta.cal_step.extract_1d = 'SKIPPED'
return input_model
Expand Down
26 changes: 26 additions & 0 deletions jwst/extract_1d/tests/test_expected_skips.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,22 @@ def mock_niriss_full():
return model


@pytest.fixture(scope='module')
def mock_niriss_f277w():
model = dm.CubeModel((3, 3, 3))
model.meta.instrument.name = 'NIRISS'
model.meta.instrument.detector = 'NIS'
model.meta.observation.date = '2023-07-22'
model.meta.observation.time = '06:24:45.569'
model.meta.instrument.name = 'NIRISS'
model.meta.instrument.detector = 'NIS'
model.meta.instrument.filter = 'F277W'
model.meta.exposure.type = 'NIS_SOSS'
model.meta.subarray.name = 'FULL'
model.data = np.arange(27).reshape((3, 3, 3))
return model


def test_expected_skip_niriss_soss_full(mock_niriss_full):

with mock_niriss_full as model:
Expand All @@ -29,3 +45,13 @@ def test_expected_skip_niriss_soss_full(mock_niriss_full):
assert result2.meta.cal_step.photom == 'SKIPPED'
assert result2.meta.cal_step.extract_1d == 'SKIPPED'
assert np.all(result2.data == model.data)


def test_expected_skip_niriss_soss_f277w(mock_niriss_f277w):

with mock_niriss_f277w as model:
result = Extract1dStep().process(model)
result2 = PhotomStep().process(result)
assert result2.meta.cal_step.photom == 'SKIPPED'
assert result2.meta.cal_step.extract_1d == 'SKIPPED'
assert np.all(result2.data == model.data)

0 comments on commit bc3274a

Please sign in to comment.