UnpackApdbFlags

class lsst.ap.association.UnpackApdbFlags(flag_map_file, table_name)

Bases: object

Class for unpacking bits from integer flag fields stored in the Apdb.

Attributes:
flag_map_filestr

Absolute or relative path to a yaml file specifiying mappings of flags to integer bits.

table_namestr

Name of the Apdb table the integer bit data are coming from.

Methods Summary

flagExists(flagName[, columnName])

Check if named flag is in the bitpacked flag set.

makeFlagBitMask(flagNames[, columnName])

Return a bitmask corresponding to the supplied flag names.

unpack(input_flag_values, flag_name)

Determine individual boolean flags from an input array of unsigned ints.

Methods Documentation

flagExists(flagName, columnName='flags')

Check if named flag is in the bitpacked flag set.

Parameters:

flagNamestr

Flag name to search for.

columnNamestr, optional

Name of bitpacked flag column to search in.

Returns:
flagExistsbool

True if flagName is present in columnName.

Raises:
ValueError

Raised if columnName is not defined.

makeFlagBitMask(flagNames, columnName='flags')

Return a bitmask corresponding to the supplied flag names.

Parameters:

flagNameslist [str]

Flag names to include in the bitmask.

columnNamestr, optional

Name of bitpacked flag column.

Returns:
bitmasknp.unit64

Bitmask corresponding to the supplied flag names given the loaded configuration.

Raises:
ValueError

Raised if a flag in flagName is not included in columnName.

unpack(input_flag_values, flag_name)

Determine individual boolean flags from an input array of unsigned ints.

Parameters:
input_flag_valuesarray-like of type uint

Array of integer packed bit flags to unpack.

flag_namestr

Apdb column name from the loaded file, e.g. “flags”.

Returns:
output_flagsnumpy.ndarray

Numpy structured array of booleans, one column per flag in the loaded file.