DQParser¶
- class stginga.utils.DQParser(definition_file)[source]¶
Bases:
object
Class to handle parsing of DQ flags.
Definition Table
A “definition table” is an ASCII table that defines each DQ flag and its short and long descriptions. It can have optional comment line(s) for metadata, e.g.:
# TELESCOPE = ANY # INSTRUMENT = ANY
It must have three columns:
DQFLAG
contains the flag value (uint16
).SHORT_DESCRIPTION
(string).LONG_DESCRIPTION
(string).
Example file contents:
# INSTRUMENT = HSTGENERIC DQFLAG SHORT_DESCRIPTION LONG_DESCRIPTION 0 "OK" "Good pixel" 1 "LOST" "Lost during compression" ... ... ...
The table format must be readable by
astropy.io.ascii
.- Parameters:
- definition_filestr
ASCII table that defines the DQ flags (see above).
- Attributes:
- tab
astropy.table.Table
Table object from given definition file.
- metadata
astropy.table.Table
Table object from file metadata.
- tab
Methods Summary
interpret_array
(data)Interpret DQ values for an array.
interpret_dqval
(dqval)Interpret DQ values for a single pixel.
Methods Documentation
- interpret_array(data)[source]¶
Interpret DQ values for an array.
Warning
If the array is large and has a lot of flagged elements, this can be resource intensive.
- Parameters:
- datandarray
DQ values.
- Returns:
- dqs_by_flagdict
Dictionary mapping each interpreted DQ value to indices of affected array elements.