Spitzer Documentation & Tools
IRS Instrument Handbook

(a) N = number of samples per ramp

(b)  0=Short-Low (SL), 1=Short-High (SH), 2 = Long-Low (LL), 3 = Long-High (LH)

(c) P = Primary, A = Ancillary

6.5  Bit Masks

Pixel status is tracked in the pipeline with several masks. In each mask, individual bits are set for each pixel that meets a particular condition. Some conditions are permanent, while others are peculiar to the current DCE (such as cosmic ray hits). Several steps in the pipeline update the current pixel status. Ultimately, each wavelength in the extracted spectrum has a status flag that is derived from all pixels that contribute to that wavelength.  In this section, we describe the masks that are of most interest to the user. WARNING: Different masks do not always use the same bit to indicate the same condition.

6.5.1             Pixel Mask - pmask.fits

The two-dimensional “pixel mask” pmask.fits tracks semi-permanent bad pixel conditions. This file is the same for many different AORs. Table 6.10 describes the bit flags set in the pmask. More information can be found in the header of the pmask.fits files, available in the cal/ directory.

Table 6.10: pmask Bit Settings.

Bit #

Condition

0

Not used

1

Not used

2

Not used

3

Not used

4

Not used

5

Not used

6

Non-linear “rogue” pixels

7

Dark current is too variable (dark calibration accuracy will be unacceptably low)

8

Not used

9

Not used

10

Dark current is too high (pixel is hot)

11

Not used

12

Not used

13

Not used

14

The pixel does not respond to light (pixel is dead)

15

Reserved: sign bit

 

6.5.2             DCE Mask - dmask.fits

The three-dimensional “DCE mask” dmask.fits stores pixel conditions encountered during a pipeline run. It is created by CVTI2R4 (Section 5.1.1) module very early in the pipeline, and updated up to the last step in the pipeline that operates on the 3D data cube, LINEARIZE (Section 5.1.11). Typical conditions masked are saturation (298,000 electrons), radiation hits, data “missing” in downlink, uncorrectable non-linearity, etc. Each of these conditions are identified sample-by-sample in the 3-D FITS file. Table 6.11 describes the conditions that cause each bit to be set. Note that bit 12 will be set if bits 7, 10, or 14 are set in the pmask, if there is digital saturation, of if data are missing in telemetry.  Samples with bit 13 set cannot be linearized either, and they will be ignored.  This mask may be useful in the case of a solar storm which resulted in an unusually high number of cosmic rays. In this case, bit 9 will be set in each sample that received a hit. If more than one sample per pixel has bit 9 set, the data from that pixel should be regarded with suspicion.

Table 6.11: dmask Bit Settings.

Bit #

Condition

0

Incomplete or questionable mux bleed correction (MUXBLEED-CORR)

1

No row droop correction applied (ROWDROOP)

2

Radhit detection was done (RADHIT)

3

Digital saturation detected (CVTI2R4)

4

Saturation corrected by IMAGEST mode 2

5

Latent-image flag

6

Droop removed using questionable value (DROOPOP)

7

Not used

8

Not used

9

RADHIT detection

10

Baseline adjustment failed (reserved for BASECAL)

11

Data bad (initial dmask; RADHIT checks this bit)

12

Non-linearity correction could not be computed (LINEARIZ)

13

Sample exceeds 280000 e−. (LINEARIZ)

14

Data missing in downlink (CVTI2R4)

15

Reserved: sign bit

 

6.5.3             BCD Mask - bmask.fits

The two-dimensional “BCD mask” bmask.fits is the pixel status mask associated with the fully processed two-dimensional BCD product. The bmask is used to describe the status of both the bcd.fits data and the f2ap.fits data. It stores pixel conditions encountered during the entire pipeline run.  The bmask uses the dmask as input, masking some of the same conditions.  However, sample-to-sample information is not retained. Instead, if one or more samples along a ramp are flagged in the dmask, then the corresponding pixel is flagged in the bmask. Additional conditions flagged in the bmask (on a pixel-by-pixel basis) are:

  • Only one or zero samples were used to compute a slope (bits 12 or 13)
  • Flat-field was not applied or was questionable (bits 7 or 8).
  • Stray light removal or cross-talk correction was not applied (bit 9).
  • Pixels 7, 10, and/or 14 masked in the pmask (bit 14).

Table 6.12 describes the conditions that cause each bit to be set. The extraction pipeline considers bits 7, 12, 13, and 14 as fatal and interpolates over them.  Bit 7 is considered fatal because it is used to signal the region in which the flat changes very rapidly (at the edges of the slit). Although the setting of bit 8 (“no flat applied”) also marks a "fatal" condition, it is used on un-illuminated regions of the slit, and is irrelevant for the extraction pipeline.

Table 6.12: bmask Bit Settings.

Bit #

Condition

0

Not used

1

Latent-image flag

2

Digital saturation detected along the ramp (bit 3 in dmask).

3

RADHIT detection along ramp (bit 9 in dmask).

4

Non-linearity correction could not be computed (bit 12 in dmask).

5

Not used

6

Droop removed using questionable value (bit 6 in dmask).

7

Flat-field applied using questionable value (FLATAP)

8

Flat-field could not be applied (FLATAP)

9

Stray-light removal or cross-talk correction not applied

10

At least one sample exceeds 280000 e−. (bit 13 in dmask).

11

Data missing in downlink (bit 14 in dmask).

12

Only one usable plane

13

No usable planes

14

Pixel masked in pmask

15

Reserved: sign bit

 

6.5.4             Co-added Masks - c2msk.fits and bkmsk.fits

The two-dimensional “Coadd 2D mask” c2msk.fits is produced by the 2D co-adder. The coadd module generates an average of multiple DCEs and performs outlier rejection; it omits pixels that are fatally flagged in the bmask. The output mask, the c2msk, does not preserve information on which fatal bit condition was set. The only conditions masked are: too few values were co-added for the pixel (currently < 1), and pixel fatally masked in bmask.

The bkmsk.fits is the mask corresponding to the bksub.fits product.  It is the result of performing the “OR” operation between the two masks of the images used in the subtraction.

Table 6.13: c2msk/bkmsk Bit Settings.

Bit #

Condition

0

Not used

1

Not used

2

Not used

3

Not used

4

Not used

5

Not used

6

Not used

7

Flat-field applied using questionable value

8

Not used

9

Not used

10

Not used

11

Not used

12

Not used

13

No valid planes are available to coadd

14

Not used

15

Reserved: sign bit

 

6.5.5             Masked Pixels in the Extracted Spectra - spect.tbl, spec2.tbl, tune.tbl, bksub.tbl

Extracted spectrum tables include a status flag for each wavelength. Multiple pixels contribute to each wavelength, and some wavelengths include fractions of some pixels. The status flag is the result of a bit-wise “OR” operation on the pixel status flags in the 2D mask file for all contributing pixels. That is, each bit in the spectrum flag is set if it was set in any of the contributing pixels, even those that contribute only fractionally to the wavelength. No information is retained about which of the contributing pixels had which status.

The definition of the bits in the status flag is the same as in the mask corresponding to the data from which the spectrum was extracted. Thus, the spect.tbl and spect2.tbl tables have flags with the same definition as the bmask.fits; tune.tbl tables have flags with the same definition as the c2msk.fits. Some status flags in the bmask are “fatal,” meaning that no usable information was contained in the flagged pixel. For example, bit 13 (“no usable planes”) is fatal. Other flags suggest that the pixel is highly suspect, but may still be of interest for some programs.