FlagManager

class sotodlib.core.FlagManager(dets_axis, samps_axis)[source]

An extension of the AxisManager class to make functions more specifically associated with cuts and flags.

FlagManagers must have a dets axis and a samps axis when created.

FlagManager only expects to have individual flags that are mapped to the detector axis, the sample axis, or both.

Detector Flags can be passed as bitmasks or boolean arrays. To match with Ranges and RangesMatrix, the default is False and the exceptions are True

__init__(dets_axis, samps_axis)[source]
wrap(name, data, axis_map=None, **kwargs)[source]

See core.AxisManager for basic usage

If axis_map is None, the data better be (dets,), (samps,),

or (dets, samps). Will not work if dets.count == samps.count

wrap_dets(name, data)[source]

Adding flag with just (dets,) axis.

wrap_samps(name, data)[source]

Adding flag with just (samps,) axis.

wrap_dets_samps(name, data)[source]

Adding flag with (dets, samps) axes.

get_zeros(wrap=None)[source]

Return a correctly sized RangesMatrix for building cuts for the FlagManager

Parameters:

wrap – if not None, it is a string with which to add to the FlagManager

buffer(n_buffer, flags=None)[source]

Buffer all the samps cuts by n_buffer Like with Ranges / Ranges Matrix, buffer changes everything in place

Parameters:
  • n_buffer – number of samples to buffer the samps cuts

  • flags – List of flags to buffer. Uses their names

buffered(n_buffer, flags=None)[source]

Return new FlagManager that has all the samps cuts buffered by n_buffer Like with Ranges / Ranges Matrix, buffered returns new object

Parameters:
  • n_buffer – number of samples to buffer the samps cuts

  • flags – List of flags to buffer. Uses their names

Returns:

FlagManager with all flags buffered

Return type:

new

reduce(flags=None, method='union', wrap=False, new_flag=None, remove_reduced=False)[source]

Reduce (combine) flags in the FlagManager together.

Parameters:
  • flags – List of flags to collapse together. Uses their names. If flags is None then all flags are reduced

  • method – How to collapse the data. Accepts ‘union’,’intersect’, or function.

  • wrap – if True, add reduced flag to self

  • new_flag – name of new flag, required if wrap is True

  • remove_reduced – if True, remove all reduced flags from self

Returns:

reduced flag

Return type:

out

has_cuts(flags=None)[source]

Return list of detector ids that have cuts

Parameters:

flags – [optional] If not none it is the list of flags to combine to see if cuts exist

classmethod for_tod(tod, dets_name='dets', samps_name='samps')[source]

Create a Flag manager for an AxisManager tod which has axes for detectors and samples.

Parameters:
  • tod – AxisManager for the specific data

  • dets_name – name of the axis that should be treated as detectors

  • samps_name – name of the axis that should be treated as samples

classmethod promote(src, dets_name, samps_name)[source]

Create an instance of this class from an AxisManager. The axes in src with names dets_name and samps_name are used for the dets and samps axes.

This is a move-style constructor, and empties out src to minimize copies.