Skip to content

Commit

Permalink
JP-3288 use DQ plane in residual_fringe code (spacetelescope#8381)
Browse files Browse the repository at this point in the history
Co-authored-by: Howard Bushouse <[email protected]>
  • Loading branch information
jemorrison and hbushouse authored Apr 10, 2024
1 parent 14c8177 commit ffc3567
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ ramp_fitting
to use uint16 instead of uint8, in order to avoid potential
overflow/wraparound problems. [#8377]

residual_fringe
---------------

- Use DQ plane to exclude pixels marked as DO_NOT_USE in correction. [#8381]

tweakreg
--------

Expand Down
2 changes: 1 addition & 1 deletion jwst/regtest/test_miri_residual_fringe.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
def test_residual_fringe_cal(rtdata, fitsdiff_default_kwargs):
"""Run residual fringe correction on MIRI IFUShort """

input_file = 'MIRM108-SHORT-6021192005_1_495_MIRIFUSHORT_cal.fits'
input_file = 'jw01523001001_03101_00001_mirifushort_cal.fits'
rtdata.get_data(f"miri/mrs/{input_file}")

args = [
Expand Down
6 changes: 4 additions & 2 deletions jwst/residual_fringe/residual_fringe.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,13 @@ def do_correction(self):
raise ErrorNoFringeFlat("The fringe flat step has not been run on file %s",
self.input_model.meta.filename)

# Remove any NaN values from the data prior to processing
# Remove any NaN values and flagged DO_NOT_USE pixels from the data prior to processing
# Set them to 0 for the residual fringe routine
# They will be re-added at the end
output_data = self.model.data.copy()
nanval_indx = np.where(~np.isfinite(output_data))
DO_NOT_USE = datamodels.dqflags.pixel["DO_NOT_USE"]
nanval_indx = np.where(np.logical_or(np.bitwise_and(self.model.dq, DO_NOT_USE).astype(bool),
~np.isfinite(output_data)))
output_data[nanval_indx] = 0

# normalise the output_data to remove units
Expand Down

0 comments on commit ffc3567

Please sign in to comment.