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.

Some input arrays may be provided as 2-D arrays, intended to match all integrations and all groups, or 4-D arrays that may have different values for each integration and group. 4-D arrays are intended to support multi-striping modes which may sample different detector regions in each integration.

Parameters:
  • data (np.ndarray) – 4-D science array (nint, ngroup, ny, nx).

  • gdq (np.ndarray) – 4-D group dq array (nint, ngroup, ny, nx).

  • pdq (np.ndarray) – 2-D pixel dq array matching the image dimensions (ny, nx). Alternately, a 4-D array may be provided, matching the data dimensions (nint, ngroup, ny, nx).

  • sat_thresh (np.ndarray) – 2-D pixel-wise threshold for saturation, matching the image dimensions (ny, nx). Alternately, a 4-D array may be provided, matching the data dimensions (nint, ngroup, ny, nx).

  • 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 (ny, nx) for use in group 2 saturation flagging for frame-averaged groups. Alternately, a 4-D array may be provided, matching the data dimensions (nint, ngroup, ny, nx).

Returns:

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

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