DataIdPacker¶
- 
class lsst.daf.butler.DataIdPacker¶
- Bases: - object- An abstract base class for a bidirectional mappings between a - DataIdand a packed integer or- bytesblob.- Derived class constructors must accept at least the positional argments required by the base class contructor, but may accept additional keyword subclass-specific arguments as well (see - configure).- Parameters: - dimensions : DataIdPackerDimensions
- Struct containing dimensions related to this - DataIdPacker.
- kwds
- Additional subclass-specific keyword arguments. Values for these arguments are obtained from the - Registrydatabase according to the how the packer is configured in the- Registry.
 - Notes - DataIdPackersubclass instances should generally be obtained from a- Registry. This involves the following steps:- One or more packers are configured in the - dataIdPackerssection of the- Registryconfiguration. In YAML form, that looks something like this:- dataIdPackers: VisitDetectorId: given: [Instrument] required: [Visit, Detector] cls: lsst.daf.butler.instrument.ObservationDataIdPacker parameters: instrument: Instrument.instrument obsMax: Instrument.visit_max detectorMax: Instrument.detector_max - See - DataIdPackerDimensionsfor a description of the- givenand- requiredoptions. The- parameterssection maps keyword argument names for the- DataIdPackersubclass constructor to dimension metadata fields in the- Registrydatabase that provide the values for these arguments.
- A - DataIdthat identifies at least the “given” dimensions of the- DataIdPackersubclass must be expanded to include those metadata fields, by calling- Registry.expandDataId.
- Registry.makeDataIdPackeris called with the name of the packer and the expanded- DataId. If the- DataIdalso identifies all “required” dimensions for the packer,- Registry.packDataIdcan be called instead for convenience (though this does not provide a way to call- unpack).
 - Attributes Summary - dimensions- The dimensions associated with the - DataIdPacker(- DataIdPackerDimensions).- maxBits- The maximum number of nonzero bits in the packed ID returned by - pack(- int).- Methods Summary - pack(dataId, *[, returnMaxBits])- Pack the given data ID into a single integer. - unpack(packedId)- Unpack an ID produced by - packinto a full- DataId.- Attributes Documentation - 
dimensions¶
- The dimensions associated with the - DataIdPacker(- DataIdPackerDimensions).
 - 
maxBits¶
- The maximum number of nonzero bits in the packed ID returned by - pack(- int).- Must be implemented by all concrete derived classes. May return - Noneto indicate that there is no maximum.
 - Methods Documentation - 
pack(dataId, *, returnMaxBits=False, **kwds)¶
- Pack the given data ID into a single integer. - Parameters: - dataId : dictorDataId
- Dictionary-like object identifying (at least) all required dimensions associated with this packer. Subclasses should in general accept an arbitrary mapping and call the - DataIdconstructor internally to standardize. Values for any keys also present in the data ID passed at construction must be the same as the values in the data ID passed at construction.
- returnMaxBits : bool
- If - True, return a tuple of- (packed, self.maxBits).
- kwds
- Additional keyword arguments forwarded to the - DataIdconstructor.
 - Returns: - Notes - Should not be overridden by derived class ( - _packshould be overridden instead).
- dataId : 
 
- dimensions :