There are two different pipelines that produce DECam calibrated images: (1) the DES Data Management (DESDM), and (2) the NOAO Community Pipeline (CP), which is basically a subset of DESDM processing. These two have different output formats and different data quality masks.
Here’s what the DESDM data quality masks look like:
–DESDM bit masks (from R. Gruendl):
BADPIX_BPM 1 /* set in bpm (hot/dead pixel/column) */ BADPIX_SATURATE 2 /* saturated pixel */ BADPIX_INTERP 4 /* interpolated pixel */ BADPIX_LOW 8 /* too little signal- i.e. poor read */ BADPIX_CRAY 16 /* cosmic ray pixel */ BADPIX_STAR 32 /* bright star pixel */ BADPIX_TRAIL 64 /* bleed trail pixel */ BADPIX_EDGEBLEED 128 /* edge bleed pixel */ BADPIX_SSXTALK 256 /* pixel potentially effected by xtalk from super-saturated source */ BADPIX_EDGE 512 /* pixel flagged to exclude CCD glowing edges */ BADPIX_STREAK 1024 /* pixel associated with satellite (airplane/meteor) streak */ BADPIX_FIX 2048 /* a bad pixel that was fixed */
Here’s what the CP data quality masks look like. These changed in late 2014 and so there are two versions:
–CP bit masks, Pre-V3.5.0 (PLVER)
Bit DQ Type PROCTYPE
1 detector bad pixel InstCal
1 detector bad pixel/no data Resampled
1 No data Stacked
2 saturated InstCal/Resampled
4 interpolated InstCal/Resampled
16 single exposure cosmic ray InstCal/Resampled
64 bleed trail InstCal/Resampled
128 multi-exposure transient InstCal/Resampled
–CP bit masks, V3.5.0 on (after ~10/28/2014), integer masks
1 = bad (in static bad pixel mask)
2 = no value (for stacks)
3 = saturated
4 = bleed mask
5 = cosmic ray
6 = low weight
7 = diff detect
See pg. 97 of the NOAO Data Handbook.
You can’t have combinations of these values (i.e. only one value per pixel), but the precedence is in the order of the list (which is also the order in which the processing discovers them). So a pixel marked as “bad” (1) won’t ever be flagged as “diff detect” (7) later on in the processing.
There was a problem with the “difference image masking” flag. So ignore this, or turn it off: clear the 8th bit 128 for Pre-V3.5.0 images and set 7 values to zero for V3.5.0 or later.