LAST_DP_PipeI_BitMask - EranOfek/AstroPack GitHub Wiki
LAST bit mask description
The images are accompanied by 32-bit mask images. Each pixel contains information about possible problems.
In addition, the bitmask are propagated to the source catalogs and stored in the FLAGS column.
For each source, the propagation is done using the OR operator for all the pixels found within a 3 pixel radius from the source position.
Bit mask description
| Bit name | Bit index | Used | Description |
|---|---|---|---|
Saturated |
0 | T | Pixel is saturated. |
LowRN |
1 | T | Pixel noise is low, Var < median(Var) * 0.03; probably a dead pixel. |
HighRN |
2 | T | Pixel noise is high, Var > 20 * median(Var); noisy pixel. |
DarkHighVal |
3 | T | Pixel bias/dark value is high, > 2 * Mean. |
DarkLowVal |
4 | T | Pixel bias/dark value is low, < 0.3 * Mean. |
BiasFlaring |
5 | T | Pixel is possibly flaring, > 20 sigma. |
NaN |
6 | T | Pixel is NaN due to illegal arithmetic operations. |
FlatHighStd |
7 | T | Flat standard error is high, Std / sqrt(N) > 0.01. |
FlatLowVal |
8 | T | Flat normalized value is low, < 0.3. |
LowQE |
9 | T | Pixel has low quantum efficiency, < 0.5 of the nominal value. |
Negative |
10 | T | Negative pixel after processing. |
Interpolated |
11 | F | Pixel value was interpolated. |
Hole |
12 | T | Hole, or anti-star. |
Spike |
13 | F | Diffraction spike. |
CR_DeltaHT |
14 | T | Cosmic ray identified using hypothesis testing against a delta function (see the note below). |
CR_Laplacian |
15 | F | Cosmic ray identified using a Laplacian filter. |
CR_Streak |
16 | F | Cosmic-ray streak. |
Ghost |
17 | F | Ghost. |
Persistent |
18 | F | Persistent charge. |
Xtalk |
19 | F | Cross talk. |
Streak |
20 | T | Streak. |
ColumnLow |
21 | F | Bad column with low values. |
ColumnHigh |
22 | F | Bad column with high values. |
NearEdge |
23 | T | Pixel is near the image edge. |
NonLinear |
24 | T | Non-linear pixel response. |
Bleeding |
25 | F | Possible bleeding/blooming. |
Overlap |
26 | T | Pixel is in an overlap region (of any crop). |
SrcNoiseDominated |
27 | T (coadd) | Source-noise-dominated pixel, (Val - Back) > Back. |
GainHigh |
28 | F | In dual-gain detectors: high-gain state. |
CoaddLessImages |
29 | T | Number of images contributing to the coadd is less than X percent. |
SrcDetected |
30 | F | Source detected; all pixels within a 1-FWHM radius from the detected source. |
| 31 | F | Unused |
Note on the Overlap bit (issue #1180)
Since Aug 2026 the Overlap bit is symmetric: every pixel covered by more than one crop carries
it in every covering crop (the flagged region is the complement of the EXCLSEC header section).
It is therefore purely geometric — do not use it to reject duplicate sources, since it flags
all copies; de-duplicate with the catalog primary column instead. Products from before this
change carry the opposite convention under the same bit (flagged only in the non-owning crop);
the presence of the EXCLSEC keyword / primary column tells which semantics applies.
Note on the CR_DeltaHT bit (issue #1333)
The bit records the outcome of the DeltaHT test — the source is flagged when the S/N measured with
a narrow, delta-like template exceeds the S/N measured with the PSF template (SN_1 > SN_2, with no
margin). Within the pipeline that test is the definition of a cosmic ray, but it is a sharpness
criterion, not a physical identification of a cosmic-ray event: anything sharper than the PSF
satisfies it, including hot or noisy pixels and marginal detections close to the detection threshold.
Measured on one LAST visit (LAST.01.07.01, 2026-04-22, 20 epochs, 6 crops): 634–1197 sources are
flagged per epoch and crop, against ~600 sources kept in the epoch catalog; 40% of the flags sit on
pixels flagged in at least 3 of the 20 epochs; and 826 pixels are flagged in every epoch, of which
~88% already carry HighRN and DarkHighVal. Cosmic rays do not repeat at a fixed detector pixel,
so a large part of the flagged population is fixed-pattern detector defects and noise peaks.
Consequences for users:
- To estimate a realistic cosmic-ray rate, this bit alone is not enough. Discard positions that
also carry
HighRN,DarkHighVal,FlatHighStdorLowQE, and positions that recur across the epochs of a visit; a genuine cosmic ray appears in a single exposure only. - Sources satisfying the test are removed from the catalog (
imProc.mask.maskCRis called withRemoveFromCat=true), so the pixel keeps the bit while the detection itself is gone. - Bits propagate from the individual images into the coadd with an OR, so a coadd pixel carries the
bit if any contributing epoch did. In the visit above this puts the bit on ~20% of the coadd
catalog rows, and
imProc.calib.fitPhotCalibTransexcludes those sources from the photometric calibration (BadBitNames).
Image quality bit mask (PSTATUS)
A second, unrelated bit mask describes the processing status of a whole image rather than of single
pixels. It is written as an integer into the PSTATUS header keyword of every epoch image and of every
coadd, and its bits are defined in config/BitMask.ImageQuality.Default.yml (issue #1318).
PSTATUS = 0 means that every step listed below produced a result.
| Bit name | Bit index | Dec | Set per | Description |
|---|---|---|---|---|
NO_BKG |
0 | 1 | image | No background and variance: they are empty, or the estimation failed and left them all NaN (issue #1226). |
NO_SRC |
1 | 2 | image | No sources in the image (an empty catalog). |
NO_PSF |
2 | 4 | image | No PSF was built for the image. |
NO_ASTR |
3 | 8 | image | No astrometric solution. |
NO_PHOTCAL |
4 | 16 | crop | The photometric calibration of the crop produced no zero point. |
NO_MERGE |
5 | 32 | crop | No merged (matched sources) catalog for the crop. |
NO_COADD |
6 | 64 | crop | No visit coadd for the crop: fewer good epochs than MinNumCoadd. |
NO_RELZP |
7 | 128 | crop | No relative photometric zero point: the fit either never ran or returned nothing, and the matched-source magnitudes of the crop are uncorrected (issue #1339). |
NOT_GOOD |
8 | 256 | epoch | The image did not take part in the coadd and in the matched sources. |
FEW_SRC |
9 | 512 | epoch | Fewer sources than the coaddition threshold MinNstars (50). |
HIGH_BKGRAD |
10 | 1024 | epoch | The background gradient over the epoch exceeds MaxFracGrad (1.0). |
Reading the values:
NOT_GOODis exactly the negation of the pipeline'sIsGoodcriterion, and it always decomposes into at least one ofNO_ASTR,NO_BKG,FEW_SRC,HIGH_BKGRAD— the four terms of that criterion.NO_SRCmeans zero sources,FEW_SRCmeans below the threshold, so an image with no sources at all carries both.HIGH_BKGRADis a property of the epoch, not of the crop: it is the spread of the background over the sub images of that epoch, so it marks all 24 crops of a bad epoch at once.- The three per-epoch bits are never set on a coadd, so a coadd
PSTATUSof 0 does not mean that all of its epochs were good. - A crop-level bit is copied onto every epoch of the crop as well as onto its coadd.