diff --git a/CHANGES.rst b/CHANGES.rst index 80e809eb25..cbe5f5685e 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -17,6 +17,16 @@ datamodels - Updated schemas for new keywords CROWDFLD, PRIDTYPE, PRIDTPTS, PATTNPTS, SMGRDPAT, changed name of SUBPXPNS to SUBPXPTS, and new allowed values for PATTTYPE. [#5618] + +flat_field +---------- + +- Added DO_NOT_USE to pixels flagged as NON_SCIENCE for non-nirspec data [#5601] + +outlier_detection +----------------- + +- Account for the background subtracted data in the blot image for determining the noise image used in flagging outliers [#5601] set_telescope_pointing ---------------------- diff --git a/jwst/flatfield/flat_field.py b/jwst/flatfield/flat_field.py index adfdd1511d..d657d9939c 100644 --- a/jwst/flatfield/flat_field.py +++ b/jwst/flatfield/flat_field.py @@ -215,6 +215,11 @@ def apply_flat_field(science, flat, inverse=False): # Combine the science and flat DQ arrays science.dq = np.bitwise_or(science.dq, flat_dq) + # Find all pixels in the flat that have a DQ value of NON_SCIENCE + # add the DO_NOT_USE flag to these pixels. We don't want to use these pixels + # in futher steps + flag_nonsci = np.bitwise_and(science.dq, dqflags.pixel['NON_SCIENCE']).astype(np.bool) + science.dq[flag_nonsci] = np.bitwise_or(science.dq[flag_nonsci], dqflags.pixel['DO_NOT_USE']) # # The following functions are for NIRSpec spectrographic data. diff --git a/jwst/outlier_detection/outlier_detection.py b/jwst/outlier_detection/outlier_detection.py index fd5b6a6da2..fbba1bde2f 100644 --- a/jwst/outlier_detection/outlier_detection.py +++ b/jwst/outlier_detection/outlier_detection.py @@ -406,7 +406,7 @@ def flag_cr(sci_image, blot_image, **pars): exptime = sci_image.meta.exposure.exposure_time sci_data = sci_image.data * exptime - blot_data = blot_image.data * exptime + blot_data = (blot_image.data + subtracted_background) * exptime blot_deriv = abs_deriv(blot_data) err_data = np.nan_to_num(sci_image.err) @@ -421,7 +421,7 @@ def flag_cr(sci_image, blot_image, **pars): # # Model the noise and create a CR mask diff_noise = np.abs(sci_data - blot_data) - ta = np.sqrt(np.abs(blot_data + subtracted_background) + err_data ** 2) + ta = np.sqrt(np.abs(blot_data) + err_data ** 2) t2 = scl1 * blot_deriv + snr1 * ta tmp1 = np.logical_not(np.greater(diff_noise, t2))