DimensionDataExtractor

class lsst.daf.butler.DimensionDataExtractor(records: dict[str, lsst.daf.butler.dimensions._record_set.DimensionRecordSet] = <factory>)

Bases: object

A helper class for extracting dimension records from expanded data IDs (e.g. for normalized serialization).

Instances of this class must be initialized with empty sets (usually by one of the class method factories) with all of the dimension elements that should be extracted from the data IDs passed to update_homogeneous or update_heterogeneous. Dimension elements not included will not be extracted (which may be useful).

Methods Summary

from_dimension_group(dimensions, *[, ...])

Construct from a DimensionGroup and a set of dimension element names to ignore.

from_element_names(element_names, universe)

Construct from an iterable of dimension element names.

update(data_ids)

Extract dimension records from an iterable of data IDs.

Methods Documentation

classmethod from_dimension_group(dimensions: DimensionGroup, *, ignore: Iterable[str] = (), ignore_cached: bool = False, include_skypix: bool = False) DimensionDataExtractor

Construct from a DimensionGroup and a set of dimension element names to ignore.

Parameters:
dimensionsDimensionGroup

Dimensions that span the set of elements whose elements are to be extracted.

ignoreIterable [ str ], optional

Names of dimension elements that should not be extracted.

ignore_cachedbool, optional

If True, ignore all dimension elements for which DimensionElement.is_cached is True.

include_skypixbool, optional

If True, include skypix dimensions. These are ignored by default because they can always be recomputed from their IDs on-the-fly.

Returns:
extractorDimensionDataExtractor

New extractor.

classmethod from_element_names(element_names: Iterable[str], universe: DimensionUniverse) DimensionDataExtractor

Construct from an iterable of dimension element names.

Parameters:
element_namesIterable [ str ]

Names of dimension elements to include.

universeDimensionUniverse

Definitions of all dimensions.

Returns:
extractorDimensionDataExtractor

New extractor.

update(data_ids: Iterable[DataCoordinate]) None

Extract dimension records from an iterable of data IDs.

Parameters:
data_idsIterable [ DataCoordinate ]

Data IDs to extract dimension records from.