QuantumContext¶
- class lsst.pipe.base.QuantumContext(butler: LimitedButler, quantum: Quantum, *, resources: ExecutionResources | None = None)¶
Bases:
object
A Butler-like class specialized for a single quantum along with context information that can influence how the task is executed.
- Parameters:
- butler
lsst.daf.butler.LimitedButler
Butler object from/to which datasets will be get/put.
- quantum
lsst.daf.butler.Quantum
Quantum object that describes the datasets which will be get/put by a single execution of this node in the pipeline graph.
- resources
ExecutionResources
, optional The resources allocated for executing quanta.
- butler
Notes
A
QuantumContext
class wraps a standard butler interface and specializes it to the context of a given quantum. What this means in practice is that the only gets and puts that this class allows are DatasetRefs that are contained in the quantum.In the future this class will also be used to record provenance on what was actually get and put. This is in contrast to what the preflight expects to be get and put by looking at the graph before execution.
Attributes Summary
Structure managing all dimensions recognized by this data repository (
DimensionUniverse
).Methods Summary
get
(dataset)Fetch data from the butler.
put
(values, dataset)Put data into the butler.
Attributes Documentation
- dimensions¶
Structure managing all dimensions recognized by this data repository (
DimensionUniverse
).
Methods Documentation
- get(dataset: InputQuantizedConnection | list[lsst.daf.butler._dataset_ref.DatasetRef | None] | list[lsst.pipe.base.connections.DeferredDatasetRef | None] | DatasetRef | DeferredDatasetRef | None) Any ¶
Fetch data from the butler.
- Parameters:
- datasetsee description
This argument may either be an
InputQuantizedConnection
which describes all the inputs of a quantum, a list ofDatasetRef
, or a singleDatasetRef
. The function will get and return the corresponding datasets from the butler. IfNone
is passed in place of aDatasetRef
then the corresponding returned object will beNone
.
- Returns:
- return
object
This function returns arbitrary objects fetched from the bulter. The structure these objects are returned in depends on the type of the input argument. If the input dataset argument is a
InputQuantizedConnection
, then the return type will be a dictionary with keys corresponding to the attributes of theInputQuantizedConnection
(which in turn are the attribute identifiers of the connections). If the input argument is of typelist
ofDatasetRef
then the return type will be a list of objects. If the input argument is a singleDatasetRef
then a single object will be returned.
- return
- Raises:
- ValueError
Raised if a
DatasetRef
is passed to get that is not defined in the quantum object
- put(values: Struct | list[Any] | Any, dataset: OutputQuantizedConnection | list[lsst.daf.butler._dataset_ref.DatasetRef] | DatasetRef) None ¶
Put data into the butler.
- Parameters:
- values
Struct
orlist
ofobject
orobject
The data that should be put with the butler. If the type of the dataset is
OutputQuantizedConnection
then this argument should be aStruct
with corresponding attribute names. Each attribute should then correspond to either a list of object or a single object depending of the type of the corresponding attribute on dataset. I.e. ifdataset.calexp
is[datasetRef1, datasetRef2]
thenvalues.calexp
should be[calexp1, calexp2]
. Like wise if there is a single ref, then only a single object need be passed. The same restriction applies if dataset is directly alist
ofDatasetRef
or a singleDatasetRef
. Ifvalues.NAME
is None, no output is written.- dataset
OutputQuantizedConnection
orlist`[`DatasetRef
] orDatasetRef
This argument may either be an
InputQuantizedConnection
which describes all the inputs of a quantum, a list oflsst.daf.butler.DatasetRef
, or a singlelsst.daf.butler.DatasetRef
. The function will get and return the corresponding datasets from the butler.
- values
- Raises:
- ValueError
Raised if a
DatasetRef
is passed to put that is not defined in theQuantum
object, or the type of values does not match what is expected from the type of dataset.