SelectionsMixin#

class caput.pipeline.tasklib.io.SelectionsMixin[source]#

Mixin for parsing axis selections, typically from a yaml config.

Attributes:
selectionsdict[str, SelectionLike], optional

A dictionary of axis selections. See below for details.

allow_index_mapbool, optonal

If true, selections can be made based on an index_map dataset. This cannot be implemented when reading from disk. See below for details. Default is False.

Notes

Selections can be given to limit the data read to specified subsets. They can be given for any named axis in the container.

Selections can be given as a slice with an <axis name>_range key with either [start, stop] or [start, stop, step] as the value. Alternatively a list of explicit indices to extract can be given with the <axis name>_index key, and the value is a list of the indices. Finally, selection based on an index_map can be given with specific index_map entries with the <axis name>_map key, which will be converted to axis indices. <axis name>_range will take precedence over <axis name>_index, which will in turn take precedence over <axis_name>_map, but you should clearly avoid doing this.

Additionally, index-based selections currently don’t work for distributed reads.

Here’s an example in the YAML format that the pipeline uses:

selections:
    freq_range: [256, 512, 4]  # A strided slice
    stack_index: [1, 2, 4, 9, 16, 25, 36, 49, 64]  # A sparse selection
    stack_range: [1, 14]  # Will override the selection above
    pol_map: ["XX", "YY"] # Select the indices corresponding to these entries

Methods#

setup()

Resolve the selections.