hispecdrp.primitives.saturation.saturation_primitive

Functions

_check_saturation_numba(data, dq_raw, dq, ...)

check_saturation(input_data, input_dq_raw, ...)

Flag saturated pixels in ramps.

Classes

CheckSaturationPrimitive([dataset, config, ...])

Flag saturated reads in the input data.

class CheckSaturationPrimitive(dataset=None, config=None, context=None, log_config=None, parent=None, **kwargs)[source]

Bases: BasePrimitive

Flag saturated reads in the input data.

This primitive identifies pixels that exceed their per-pixel saturation threshold, as defined in the saturation calibration reference file. For any read in which a pixel is saturated, the corresponding SATURATED flag is set in the data quality (DQ) array.

Parameters:
  • dataset (str or RampModel) – Input file path or data model to process. Currently, this is expected to be a raw (ramp) data product.

  • suffix (str or None, optional) – Suffix to append to the output filename. Default is 'satcheck'.

  • max_cores (int, optional) – Maximum number of CPU cores to use for processing. Default is 1 (no parallelization).

Returns:

output (DataModel) – Data model with the SATURATED DQ flags set for affected pixels and reads.

Calibrations:
  • saturation (SaturationModel) –

  • - **saturation** (SaturationModel) – The saturation calibration model used for flagging.

check_saturation(input_data, input_dq_raw, input_dq, sat_thresh, sat_dq, max_cores=1)[source]

Flag saturated pixels in ramps.

Parameters:
  • input_data (np.ndarray) – The input ramp data array of shape (Nreads, Ny, Nx).

  • input_dq_raw (np.ndarray) – The input DQ_RAW array of shape (Nreads, Ny, Nx).

  • input_dq (np.ndarray) – The input DQ array of shape (Ny, Nx).

  • sat_thresh (np.ndarray) – The saturation threshold map of shape (Ny, Nx).

  • sat_dq (np.ndarray) – The DQ map from the saturation model of shape (Ny, Nx).

  • max_cores (int) – The maximum number of CPU cores to use.

Returns:
  • input_dq_raw (np.ndarray) – The updated DQ_RAW array with saturation flags applied.

  • input_dq (np.ndarray) – The updated DQ array with saturation flags applied.