Quality Flags (corrections.quality)

Handling of TESS data quality flags.

Code author: Rasmus Handberg <rasmush@phys.au.dk>

class corrections.quality.CorrectorQualityFlags[source]

Bases: QualityFlagsBase

This class encodes the meaning of the various TESS QUALITY bitmask flags.

CBV_BITMASK = 2
DEFAULT_BITMASK = 3
FlaggedBadData = 1
Interpolated = 128
JumpAdditiveConstant = 8
JumpAdditiveLinear = 16
JumpMultiplicativeConstant = 32
JumpMultiplicativeLinear = 64
ManualExclude = 2
Rejected = 256
STRINGS = {1: 'Bad data based on pixel flags', 2: 'Manual exclude', 4: 'Point removed due to sigma clipping', 8: 'Jump corrected using additive constant', 16: 'Jump corrected using additive linear trend', 32: 'Jumb corrected using multiplicative constant', 64: 'Jump corrected using multiplicative linear trend', 128: 'Point is interpolated', 256: 'Point has been rejected in processing'}
SigmaClip = 4
class corrections.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.

Returns:

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.

Parameters:
  • quality (integer or ndarray) – Quality flags.

  • flags (integer bitmask) – Default=``TESSQualityFlags.DEFAULT_BITMASK``.

Returns:

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

Return type:

ndarray

HARDEST_BITMASK = 4294967295
class corrections.quality.TESSQualityFlags[source]

Bases: QualityFlagsBase

This class encodes the meaning of the various TESS PIXEL_QUALITY bitmask flags.

ApertureCosmic = 64
AttitudeTweak = 1
CBV_BITMASK = 170
CoarsePoint = 4
CollateralCosmic = 1024
DEFAULT_BITMASK = 4335
Desat = 32
EarthMoonPlanetInFOV = 2048
EarthPoint = 8
HARD_BITMASK = 5615
ImpulsiveOutlier = 512
ManualExclude = 128
STRINGS = {1: 'Attitude tweak', 2: 'Safe mode', 4: 'Spacecraft in Coarse point', 8: 'Spacecraft in Earth point', 16: 'Reaction wheel zero crossing', 32: 'Reaction wheel desaturation event', 64: 'Cosmic ray in optimal aperture pixel', 128: 'Manual exclude', 256: 'Sudden sensitivity dropout', 512: 'Impulsive outlier', 1024: 'Cosmic ray in collateral data', 2048: 'Earth, Moon or other planet in camera FOV', 4096: 'Scattered light from Earth or Moon in CCD'}
SafeMode = 2
ScatteredLight = 4096
SensitivityDropout = 256
ZeroCrossing = 16