DimensionRecordSetDeserializer¶
- class lsst.daf.butler.DimensionRecordSetDeserializer(element: DimensionElement, mapping: dict[tuple[DataIdValue, ...], SerializedKeyValueDimensionRecord])¶
Bases:
object
A helper class for deserializing sets of dimension records, with support for only fully deserializing certain records.
The
from_raw
factory 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
tuple
for reach record to the remainder of its raw serialization (i.e. an item in thisdict
is a pair returned byDimensionRecord.deserialize_key
). Thisdict
will 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_records
or repeated calls toDimensionRecord.serialize_key_value
.
- element
- Returns:
- deserializer
DimensionRecordSetDeserializer
New deserializer instance.
- deserializer