DimensionPacker¶
-
class
lsst.daf.butler.
DimensionPacker
(fixed: lsst.daf.butler.core.dimensions._coordinate.DataCoordinate, dimensions: lsst.daf.butler.core.dimensions._graph.DimensionGraph)¶ Bases:
object
Class for going from
DataCoordinate
to packed integer ID and back.An abstract base class for bidirectional mappings between a
DataCoordinate
and a packed integer ID.Parameters: - fixed :
DataCoordinate
Expanded data ID for the dimensions whose values must remain fixed (to these values) in all calls to
pack
, and are used in the results of calls tounpack
.fixed.hasRecords()
must returnTrue
.- dimensions :
DimensionGraph
The dimensions of data IDs packed by this instance.
Attributes Summary
maxBits
Return The maximum number of nonzero bits in the packed ID. universe
Graph containing all known dimensions ( DimensionUniverse
).Methods Summary
pack
(dataId, Mapping[str, Any]], *, …)Pack the given data ID into a single integer. unpack
(packedId)Unpack an ID produced by pack
into a fullDataCoordinate
.Attributes Documentation
-
maxBits
¶ Return The maximum number of nonzero bits in the packed ID.
This packed ID will be returned by
pack
(int
).Must be implemented by all concrete derived classes. May return
None
to indicate that there is no maximum.
-
universe
¶ Graph containing all known dimensions (
DimensionUniverse
).
Methods Documentation
-
pack
(dataId: Union[lsst.daf.butler.core.dimensions._coordinate.DataCoordinate, Mapping[str, Any]], *, returnMaxBits: bool = False, **kwargs) → Union[Tuple[int, int], int]¶ Pack the given data ID into a single integer.
Parameters: - dataId :
DataId
Data ID to pack. Values for any keys also present in the “fixed” data ID passed at construction must be the same as the values passed at construction.
- returnMaxBits :
bool
If
True
, return a tuple of(packed, self.maxBits)
.- **kwargs
Additional keyword arguments forwarded to
DataCoordinate.standardize
.
Returns: Notes
Should not be overridden by derived class (
_pack
should be overridden instead).- dataId :
-
unpack
(packedId: int) → lsst.daf.butler.core.dimensions._coordinate.DataCoordinate¶ Unpack an ID produced by
pack
into a fullDataCoordinate
.Must be implemented by all concrete derived classes.
Parameters: Returns: - dataId :
DataCoordinate
Dictionary-like ID that uniquely identifies all covered dimensions.
- dataId :
- fixed :