dqflags_to_mnemonics
- stdatamodels.dqflags.dqflags_to_mnemonics(dqflags, mnemonic_map)
Interpret value as bit flags and return the mnemonics.
- Parameters:
- dqflagsint-like
The value to interpret as DQ flags
- mnemonic_mapdict
Dictionary associating the mnemonic string to an integer value representing the set bit for that mnemonic.
- Returns:
- mnemonicsset
Set of mnemonics represented by the set bit flags
Examples
>>> pixel = { ... "GOOD": 0, # No bits set, all is good ... "DO_NOT_USE": 2**0, # Bad pixel. Do not use ... "SATURATED": 2**1, # Pixel saturated during exposure ... "JUMP_DET": 2**2, # Jump detected during exposure ... }
>>> group = { ... "GOOD": pixel["GOOD"], ... "DO_NOT_USE": pixel["DO_NOT_USE"], ... "SATURATED": pixel["SATURATED"], ... }
>>> dqflags_to_mnemonics(1, pixel) {'DO_NOT_USE'}
>>> dqflags_to_mnemonics(7, pixel) {'JUMP_DET', 'DO_NOT_USE', 'SATURATED'}
>>> dqflags_to_mnemonics(7, pixel) == {"JUMP_DET", "DO_NOT_USE", "SATURATED"} True
>>> dqflags_to_mnemonics(1, mnemonic_map=pixel) {'DO_NOT_USE'}
>>> dqflags_to_mnemonics(1, mnemonic_map=group) {'DO_NOT_USE'}