Quantum¶
- class lsst.daf.butler.Quantum(*, taskName: str | None = None, taskClass: type | None = None, dataId: DataCoordinate | None = None, initInputs: Mapping[DatasetType, DatasetRef] | Iterable[DatasetRef] | None = None, inputs: Mapping[DatasetType, list[lsst.daf.butler.core.datasets.ref.DatasetRef]] | None = None, outputs: Mapping[DatasetType, list[lsst.daf.butler.core.datasets.ref.DatasetRef]] | None = None, datastore_records: Mapping[str, DatastoreRecordData] | None = None)¶
Bases:
object
Class representing a discrete unit of work.
A Quantum may depend on one or more datasets and produce one or more datasets.
Most Quanta will be executions of a particular
PipelineTask
’srunQuantum
method, but they can also be used to represent discrete units of work performed manually by human operators or other software agents.- Parameters:
- taskName
str
, optional Fully-qualified name of the Task class that executed or will execute this Quantum. If not provided,
taskClass
must be.- taskClass
type
, optional The Task class that executed or will execute this Quantum. If not provided,
taskName
must be. OverridestaskName
if both are provided.- dataId
DataId
, optional The dimension values that identify this
Quantum
.- initInputscollection of
DatasetRef
, optional Datasets that are needed to construct an instance of the Task. May be a flat iterable of
DatasetRef
instances or a mapping fromDatasetType
toDatasetRef
.- inputs
Mapping
, optional Inputs identified prior to execution, organized as a mapping from
DatasetType
to a list ofDatasetRef
.- outputs
Mapping
, optional Outputs from executing this quantum of work, organized as a mapping from
DatasetType
to a list ofDatasetRef
.- datastore_records
DatastoreRecordData
, optional Datastore record data for input or initInput datasets that already exist.
- taskName
Attributes Summary
Return dimension values of the unit of processing (
DataId
).Tabular data stored with this quantum (
dict
).Return mapping of datasets used to construct the Task.
Return mapping of input datasets that were expected to be used.
Return mapping of output datasets (to be) generated by this quantum.
Return Fully-qualified name of the task associated with
Quantum
.Methods Summary
from_simple
(simple, universe[, ...])Construct a new object from a simplified form.
to_simple
([accumulator])Convert this class to a simple python type.
Attributes Documentation
- dataId¶
Return dimension values of the unit of processing (
DataId
).
- datastore_records¶
Tabular data stored with this quantum (
dict
).This attribute may be modified in place, but not assigned to.
- initInputs¶
Return mapping of datasets used to construct the Task.
Has
DatasetType
instances as keys (names can also be used for lookups) andDatasetRef
instances as values.
- inputs¶
Return mapping of input datasets that were expected to be used.
Has
DatasetType
instances as keys (names can also be used for lookups) and a list ofDatasetRef
instances as values.Notes
We cannot use
set
instead oflist
for the nested container becauseDatasetRef
instances cannot be compared reliably when some have integers IDs and others do not.
- outputs¶
Return mapping of output datasets (to be) generated by this quantum.
Has the same form as
predictedInputs
.Notes
We cannot use
set
instead oflist
for the nested container becauseDatasetRef
instances cannot be compared reliably when some have integers IDs and others do not.
Methods Documentation
- classmethod from_simple(simple: SerializedQuantum, universe: DimensionUniverse, reconstitutedDimensions: dict[int, tuple[str, lsst.daf.butler.core.dimensions._records.DimensionRecord]] | None = None) Quantum ¶
Construct a new object from a simplified form.
Generally this is data returned from the
to_simple
method.- Parameters:
- simpleSerializedQuantum
The value returned by a call to
to_simple
- universe
DimensionUniverse
The special graph of all known dimensions.
- reconstitutedDimensions
dict
ofint
toDimensionRecord
or None A mapping of ids to dimension records to be used when populating dimensions for this Quantum. If supplied it will be used in place of the dimension Records stored with the SerializedQuantum, if a required dimension has already been loaded. Otherwise the record will be unpersisted from the SerializedQuatnum and added to the reconstitutedDimensions dict (if not None). Defaults to None.
- to_simple(accumulator: DimensionRecordsAccumulator | None = None) SerializedQuantum ¶
Convert this class to a simple python type.
This makes it suitable for serialization.
- Parameters:
- accumulator
DimensionRecordsAccumulator
, optional This accumulator can be used to aggregate dimension records accross multiple Quanta. If this is None, the default, dimension records are serialized with this Quantum. If an accumulator is supplied it is assumed something else is responsible for serializing the records, and they will not be stored with the SerializedQuantum.
- accumulator
- Returns:
- simple
SerializedQuantum
This object converted to a serializable representation.
- simple