Understanding masks in Reduced images - DECam gen3

Hi all :slight_smile:

I’m currently analysing the masks from the reduced DECam images using the LSST pipeline (gen3), and I am having some trouble interpreting its values.

Here is an example of a reduced image from DECam in one detector, with the masks displayed in 70% opacity and scaled with asinh.

The magenta circle marks the galaxy I’m interested in. If I do a 30x30 pixel cutout surrounding the galaxy, I obtain the following stamp:
Screenshot 2025-09-12 at 11.01.14

The mask associated with the stamp is:

[[1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056]
 [1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056]
 [1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056]
 [1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056]
 [1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056]
 [1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056]
 [1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056]
 [1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056]
 [1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056]
 [1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056]
 [1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056]
 [1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056]
 [1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056]
 [1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056]
 [1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056]
 [1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056]
 [1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056]
 [1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056]
 [1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056]
 [1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056]
 [1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056]
 [1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056]
 [1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056]
 [1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056]
 [1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056]
 [1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056]
 [1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056]
 [1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056]
 [1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056]
 [1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056 1056
  1056 1056]], bbox=(minimum=(79, 1925), maximum=(108, 1954)), maskPlaneDict={'BAD': 0, 'CR': 3, 'CROSSTALK': 9, 'DETECTED': 5, 'DETECTED_NEGATIVE': 6, 'EDGE': 4, 'INTRP': 2, 'NOT_DEBLENDED': 10, 'NO_DATA': 8, 'SAT': 1, 'SUSPECT': 7, 'UNMASKEDNAN': 11}

Here arises my confusion, from the mask dictionary I would (in principle) understand that this source is simultaneously DETECTED (5), DETECTED NEGATIVE (6), BAD (0) and SAT (1) or NOT DEBLENDED (10). At the same time, the color displayed in the stamp looks green, which according in the dictionary implies that is saturated or INTRP.

{'BAD': 'red',
 'CR': 'magenta',
 'EDGE': 'yellow',
 'INTERPOLATED': 'green',
 'SATURATED': 'green',
 'DETECTED': 'blue',
 'DETECTED_NEGATIVE': 'cyan',
 'SUSPECT': 'yellow',
 'NO_DATA': 'orange',
 'INTRP': 'green',
 'SAT': 'green'}

I would like to hear your suggestions about how to effectively interpret these masks, so I can automate this process and not revise the masks for all galaxies to understand what the mask truly means. Is there any rule to do this?

Thanks a lot!!!
Paula.

You should consider the values of the bitmask to be the source of truth for mask plane visualization, and it is unfortunate that different mask planes and combinations of mask planes can end up displaying with the same color. One detail I am surprised by in your post is that both SATURATED and SAT mask planes exist - within the LSST pipelines there should only be the SAT mask plane for saturated pixels.

It is also useful if you report the specific pipeline version you are using when you ask questions. “gen3” has been true for a number of years now.

I’ve marked Ian’s response as the solution here, because the values of the bitmask are truth, and the colors can be reassigned however you like.

But please feel free to follow-up in this thread or open a new topic if that didn’t quite resolve the issue.

I have a few extra pointers.

In both of the DP1 tutorials “202.1. Deep coadds” and “202.2 Visit images”, in their “Section 3.3. Mask plane”, there is a demonstration of how to print a list of the unique mask array values, the number of pixels with that value, and the overlapping masks for pixels with that value. I think that part you already know, as you were able to interpret what a value 1056 means.

In the DP1 tutorial “103.5. Image display with Firefly”, in “Section 5. Manipulate the mask”, it demonstrates how to reassign mask colors, too.