# LSST Mask Planes to Euclid Flag Maps

**URL:** <https://www.rubin.community/t/lsst-mask-planes-to-euclid-flag-maps/6130>\
**Category:** Data Management\
**Tags:** dm-dev\
**Created:** [November 26, 2021, 12:09pm UTC](https://www.rubin.community/t/lsst-mask-planes-to-euclid-flag-maps/6130 "2021-11-26T12:09:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rfahed](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@rfahed](https://www.rubin.community/u/rfahed)\
**Post date:** [November 26, 2021, 12:09pm UTC](https://www.rubin.community/t/lsst-mask-planes-to-euclid-flag-maps/6130/1 "2021-11-26T12:09:23Z")

</div>

Hello,  
I am working for Euclid and have the responsability of the lsst data processing within the Euclid infrastruture.  
I was asked about the bit flags used in LSST, and saw that you are refering to **Mask Planes Number** whereas Euclid uses **Bit Mask Value** in their documentation.  
I guessed that the correspondance between the two was as follow :

```auto
BIT_PLANE FLAGMAP_BIT	BIT_VALUE	   
0 0x00000001 1 BAD						
1 0x00000002 2 SAT						
2 0x00000004 4 INTRP					
3 0x00000008 8 CR						
4 0x00000010 16 EDGE					
5 0x00000020 32 DETECTED				
6 0x00000040 64 DETECTED_NEGATIVE
7 0x00000080 128 SUSPECT

```

Can someone tell me if this is correct ?  
Thank you for your help.

Rémi

---

<div class="post-metadata">

**Author:** ![ktl](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/ktl/32/1373_2.png) [@ktl](https://www.rubin.community/u/ktl)\
**Post date:** [November 26, 2021, 3:11pm UTC](https://www.rubin.community/t/lsst-mask-planes-to-euclid-flag-maps/6130/2 "2021-11-26T15:11:20Z")

</div>

[LSST Applications: How Mask Planes are handled in @c afw](http://doxygen.lsst.codes/stack/doxygen/x_masterDoxyDoc/afw_mask_planes.html) gives some information. Basically, the mapping from name to bit and bit value is not fixed; it can vary between image types (and even theoretically from image to image). But it is always recorded so that code can reliably use names.

---

<div class="post-metadata">

**Author:** ![DouglasLTucker](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/douglasltucker/32/1341_2.png) [@DouglasLTucker](https://www.rubin.community/u/DouglasLTucker)\
**Post date:** [November 29, 2021, 1:27am UTC](https://www.rubin.community/t/lsst-mask-planes-to-euclid-flag-maps/6130/3 "2021-11-29T01:27:29Z")

</div>

Dear Rémi,  
I am not sure if the following helps, but I have been doing some validation tests of the mask planes from test data processing sets for the Rubin LSST DP0.2 campaign. I “borrowed” some code from Brant Robertson and Alex Drlica-Wagner’s Rubin LSST Stack club jupyter notebook [AFW\_Display\_Demo.ipynb](https://github.com/LSSTScienceCollaborations/StackClub/blob/master/Visualization/AFW_Display_Demo.ipynb) and found the following for Rubin DP0.2-processed calexp image masks:

 ![Screen Shot 2021-11-28 at 7.24.22 PM](https://us1.discourse-cdn.com/flex002/uploads/rubin/original/2X/9/9e494e019d4aebaaf843d9282e29dabcd07581dd.png)

As K-T Lim mentions above, mapping between the name to bit value is not fixed and can vary between image types; e.g., I suspect things may differ for the coadd images.

I hope this helps!
