DimensionRecordSetDeserializer¶
- class lsst.daf.butler.DimensionRecordSetDeserializer(element: DimensionElement, mapping: dict[tuple[DataIdValue, ...], SerializedKeyValueDimensionRecord])¶
Bases:
objectA helper class for deserializing sets of dimension records, with support for only fully deserializing certain records.
The
from_rawfactory method should generally be used instead of calling the constructor directly.- Parameters:
- element
DimensionElement Dimension element that defines all records.
- mapping
dict[tuple,list] A dictionary that maps the data ID required-values
tuplefor reach record to the remainder of its raw serialization (i.e. an item in thisdictis a pair returned byDimensionRecord.deserialize_key). Thisdictwill be used directly to back the deserializer, not copied.
- element
Notes
The keys (data ID required-values tuples) of all rows are deserialized immediately, but the remaining fields are deserialized only on demand; use
__iter__to deserialize all records or__getitem__to deserialize only a few. An instance should really only be used for a single iteration or multiple__getitem__calls, as each call will re-deserialize the records in play; deserialized records are not cached.The caller is responsible for ensuring that the serialized records are for the given dimension element, as this cannot be checked. Mismatches will probably result in a (confusing) type-validation error, but are not guaranteed to.
Methods Summary
from_raw(element, raw_records)Construct from raw serialized records.
Methods Documentation
- classmethod from_raw(element: DimensionElement, raw_records: Iterable[SerializedKeyValueDimensionRecord]) Self¶
Construct from raw serialized records.
- Parameters:
- element
DimensionElement Dimension element that defines all records.
- raw_records
Iterable[list] Serialized records, as returned by
DimensionRecordSet.serialize_recordsor repeated calls toDimensionRecord.serialize_key_value.
- element
- Returns:
- deserializer
DimensionRecordSetDeserializer New deserializer instance.
- deserializer