flag_saturated_pixels

stcal.saturation.flag_saturated_pixels(data, gdq, pdq, sat_thresh, sat_dq, atod_limit, dqflags, n_pix_grow_sat=1, zframe=None, read_pattern=None, bias=None)[source]

Flag saturated pixels.

Apply flagging for saturation based on threshold values stored in the saturation reference file data sat_thresh and A/D floor based on testing for 0 DN values. For A/D floor flagged groups, the DO_NOT_USE flag is also set.

Parameters:
  • data (np.ndarray) – 4-D science array

  • gdq (np.ndarray) – 4-D group dq array

  • pdq (np.ndarray) – 2-D pixel dq array

  • sat_thresh (np.ndarray) – Pixel-wise threshold for saturation, same shape data

  • sat_dq (np.ndarray) – Data quality flags associated with sat_thresh

  • atod_limit (int) – Hard DN limit of 16-bit A-to-D converter

  • dqflags (dict) – A dictionary with at least the following keywords: DO_NOT_USE, SATURATED, AD_FLOOR, NO_SAT_CHECK providing a mapping between flag names and their integer values.

  • n_pix_grow_sat (int) – Number of pixels that each flagged saturated pixel should be ‘grown’, to account for charge spilling. Default is 1.

  • zframe (np.ndarray) – The ZEROFRAME 3-D array.

  • read_pattern (List[List[float or int]] or None) – The times or indices of the frames composing each group.

  • bias (np.ndarray) – 2-D superbias array. For use in group 2 saturation flagging for frame-averaged groups.

Returns:

  • gdq (np.ndarray) – Updated 4-D group dq array

  • pdq (np.ndarray) – Updated 2-D pixel dq array