BitFlagNameMap#

class astropy.nddata.BitFlagNameMap[source]#

Bases: object

A base class for bit flag name maps used to describe data quality (DQ) flags of images by provinding a mapping from a mnemonic flag name to a flag value.

Mapping for a specific instrument should subclass this class. Subclasses should define flags as class attributes with integer values that are powers of 2. Each bit flag may also contain a string comment following the flag value.

Examples

>>> from astropy.nddata.bitmask import BitFlagNameMap
>>> class ST_DQ(BitFlagNameMap):
...     __version__ = '1.0.0'  # optional
...     CR = 1, 'Cosmic Ray'
...     CLOUDY = 4  # no docstring comment
...     RAINY = 8, 'Dome closed'
...
>>> class ST_CAM1_DQ(ST_DQ):
...     HOT = 16
...     DEAD = 32