Description

Class:

jwst.dq_init.dq_init_step.DQInitStep

Alias:

dq_init

The Data Quality (DQ) initialization step in the calibration pipeline populates the DQ mask for the input dataset. Flag values from the appropriate static mask (“MASK”) reference file in CRDS are copied into the PIXELDQ array of the input dataset, because it is assumed that flags in the MASK Reference File pertain to problem conditions that affect all groups and integrations for a given pixel.

The actual process consists of the following steps:

  1. Determine what MASK Reference File to use via the interface to the bestref utility in CRDS.

  2. If the PIXELDQ or GROUPDQ arrays of the input dataset do not already exist, which is sometimes the case for raw input products, create these arrays in the input data model and initialize them to zero. The PIXELDQ array for most exposures will be 2D, with the same number of rows and columns as the input science data. The GROUPDQ array will be 4D with the same dimensions (nints, ngroups, nrows, ncols) as the input science data array.

    For superstripe data, the PIXELDQ array is 3D, where the each image in the first dimension corresponds to a different region on the detector (stripe). The other two dimensions are (nrows, ncols), matching the image dimensions of the input data.

  3. Check to see if the input science data is in subarray mode. If so, extract a matching subarray from the full-frame MASK Reference File.

    Likewise, if the input data was taken with the superstripe readout mode, extract regions from the full-frame mask matching each stripe.

  4. Propagate the DQ flags from the reference file DQ array to the science data “PIXELDQ” array using a bitwise-or operation.

  5. Propagate any DO_NOT_USE flags from the reference file DQ array to the science data “GROUPDQ” array, if present; this avoids generating a ramp in ramp_fit for pixels marked as unusable by the reference file.

FGS guide star data

Note that when applying the dq_init step to FGS guide star data, as is done in the calwebb_guider pipeline, the flags from the MASK Reference File are propagated into the guide star dataset “DQ” array, instead of the “PIXELDQ” array. The step identifies guide star data based on the following exposure type (EXP_TYPE keyword) values:

  • FGS_ID-IMAGE

  • FGS_ID-STACK

  • FGS_ACQ1

  • FGS_ACQ2

  • FGS_TRACK

  • FGS_FINEGUIDE

NIRSpec IRS2

No special handling is required for NIRSpec exposures taken using the IRS2 readout pattern, because matching IRS2 MASK Reference File are supplied in CRDS.