extend_bit_flag_map#
- astropy.nddata.bitmask.extend_bit_flag_map(cls_name, base_cls=<BitFlagNameMap 'BitFlagNameMap'>, **kwargs)[source]#
A convenience function for creating bit flags maps by subclassing an existing map and adding additional flags supplied as keyword arguments.
- Parameters:
- cls_name
str
Class name of the bit flag map to be created.
- base_cls
BitFlagNameMap
, optional Base class for the new bit flag map.
- **kwargs
int
Each supplied keyword argument will be used to define bit flag names in the new map. In addition to bit flag names,
__version__
is allowed to indicate the version of the newly created map.
- cls_name
Examples
>>> from astropy.nddata.bitmask import extend_bit_flag_map >>> ST_DQ = extend_bit_flag_map('ST_DQ', __version__='1.0.0', CR=1, CLOUDY=4, RAINY=8) >>> ST_CAM1_DQ = extend_bit_flag_map('ST_CAM1_DQ', ST_DQ, HOT=16, DEAD=32) >>> ST_CAM1_DQ['HOT'] # <-- Access flags as dictionary keys 16 >>> ST_CAM1_DQ.HOT # <-- Access flags as class attributes 16