DimensionDataAttacher¶
- class lsst.daf.butler.DimensionDataAttacher(*, records: Iterable[DimensionRecordSet] = (), deserializers: Iterable[DimensionRecordSetDeserializer] = (), cache: DimensionRecordCache | None = None, dimensions: DimensionGroup | None = None)¶
Bases:
object
A helper class for attaching dimension records to data IDs.
- Parameters:
- records
dict
[str
,DimensionRecordSet
], optional Regular dimension record sets, keyed by dimension element name. Not copied, and may be modified in-place.
- deserializers
dict
[str
,DimensionRecordSetDeserializer
], optional Partially-deserialized dimension records, keyed by dimension element name. Records will be fully deserialized on demand and then cached.
- cache
DimensionRecordCache
, optional A cache of dimension records from a butler instance. If present, this is assumed to have records for elements that are not in
records
anddeserializers
.- dimensions
DimensionGroup
, optional Dimensions for which empty record sets should be added when no other source of records is given. This allows data IDs with these dimensions to have records attached by fetching them via the
query
argument to theattach
method, or by computing regions on the skypix dimensions.
- records
Methods Summary
attach
(dimensions, data_ids[, query])Attach dimension records to data IDs.
serialized
(*[, ignore, ignore_cached, ...])Serialize all dimension data in this attacher, with deduplication across fully- and partially-deserialized records.
Methods Documentation
- attach(dimensions: DimensionGroup, data_ids: Iterable[DataCoordinate], query: Query | None = None) list[DataCoordinate] ¶
Attach dimension records to data IDs.
- Parameters:
- dimensions
DimensionGroup
Dimensions of all given data IDs. All dimension elements must have been referenced in at least one of the constructor arguments.
- data_ids
Iterable
[DataCoordinate
] Data IDs to attach dimension records to (not in place; data coordinates are immutable).
- query
queries.Query
, optional A butler query that can be used to look up missing dimension records. Records fetched via query are cached in the
records
attribute.
- dimensions
- Returns:
- expanded
list
[DataCoordinate
] Data IDs with dimension records attached, in the same order as the original iterable.
- expanded
- serialized(*, ignore: Iterable[str] = (), ignore_cached: bool = False, include_skypix: bool = False) SerializableDimensionData ¶
Serialize all dimension data in this attacher, with deduplication across fully- and partially-deserialized records.
- Parameters:
- ignore
Iterable
[str
], optional Names of dimension elements that should not be serialized.
- ignore_cached
bool
, optional If
True
, ignore all dimension elements for whichDimensionElement.is_cached
isTrue
.- include_skypix
bool
, optional If
True
, include skypix dimensions. These are ignored by default because they can always be recomputed from their IDs on-the-fly.
- ignore
- Returns:
- serialized
SerializedDimensionData
Serialized dimension records.
- serialized