Data Validation Quality Flags (dataval.quality)

Handling of TESS data quality flags.

Code author: Rasmus Handberg <>

class dataval.quality.DatavalQualityFlags[source]

Bases: dataval.quality.QualityFlagsBase

ContaminationHigh = 2048
ContaminationOne = 1024
FluxFFIOverTPF = 4
FluxTPFOverFFI = 8
InvalidFlux = 4096
InvalidNoise = 8192
LargeMask = 64
LowPTP = 256
LowRMS = 512
MagVsFluxHigh = 1
MagVsFluxLow = 2
MinimalMask = 16
STRINGS = {1: 'Star has higher flux than given by magnitude relation', 2: 'Star has lower flux than given by magnitude relation', 4: 'Star has higher measured flux in FFIs than TPFs', 8: 'Star has higher measured flux in TPFs than FFIs', 16: 'Star has minimum 4x4 mask', 32: 'Star has smaller mask than general relation', 64: 'Star has larger mask than general relation', 128: 'Smaller stamp than default', 256: 'PTP lower than theoretical', 512: 'RMS lower than theoretical', 1024: 'Contamination over 1', 2048: 'Contamination high', 4096: 'Invalid mean flux (not finite or negative)'}
SmallMask = 32
SmallStamp = 128
class dataval.quality.QualityFlagsBase[source]

Bases: object

static binary_repr(quality)[source]

Binary representation of the quality flag.

Parameters:quality (int or ndarray) – Quality flag.
Returns:Binary representation of quality flag. String will be 32 characters long.
Return type:string
classmethod decode(quality)[source]

Converts a QUALITY value into a list of human-readable strings. This function takes the QUALITY bitstring that can be found for each cadence in TESS data files and converts into a list of human-readable strings explaining the flags raised (if any).

Parameters:quality (int) – Value from the ‘QUALITY’ column of a TESS data file.
List of human-readable strings giving a short
description of the quality flags raised.
Returns an empty list if no flags raised.
Return type:list of str
classmethod filter(quality, flags=None)[source]

Filter quality flags against a specific set of flags.

  • quality (integer or ndarray) – Quality flags.
  • flags (integer bitmask) – Default=``TESSQualityFlags.DEFAULT_BITMASK``.

True if quality DOES NOT contain any of the specified flags, False otherwise.

Return type: