PredictedQuantumGraphComponents¶
- class lsst.pipe.base.quantum_graph.PredictedQuantumGraphComponents(*, header: ~lsst.pipe.base.quantum_graph._common.HeaderModel = <factory>, pipeline_graph: ~lsst.pipe.base.pipeline_graph._pipeline_graph.PipelineGraph, dimension_data: ~lsst.daf.butler.dimensions._record_set.DimensionDataAttacher | None = None, init_quanta: ~lsst.pipe.base.quantum_graph._predicted.PredictedInitQuantaModel = <factory>, thin_graph: ~lsst.pipe.base.quantum_graph._predicted.PredictedThinGraphModel = <factory>, quantum_datasets: dict[uuid.UUID, lsst.pipe.base.quantum_graph._predicted.PredictedQuantumDatasetsModel] = <factory>, quantum_indices: dict[uuid.UUID, int] = <factory>)¶
Bases:
objectA helper class for building and writing predicted quantum graphs.
Notes
This class is a simple struct of model classes to allow different tools that build predicted quantum graphs to assemble them in whatever order they prefer. It does not enforce any internal invariants (e.g. the quantum and dataset counts in the header, different representations of quanta, internal ID sorting, etc.), but it does provide methods that can satisfy them.
Attributes Summary
Object that can attach dimension records to data IDs.
Methods Summary
assemble()Construct a
PredictedQuantumGraphfrom these components.from_old_quantum_graph(old_quantum_graph)Construct from an old
QuantumGraphinstance.make_dataset_ref(predicted)Make a
lsst.daf.butler.DatasetReffrom information in the predicted quantum graph.read_execution_quanta(uri[, quantum_ids, ...])Read one or more executable quanta from a quantum graph file.
Populate the quantum and dataset counts in the header from the
quantum_indices,thin_graph,init_quanta, andquantum_datasetscomponents.Populate the
quantum_indicescomponent by sorting the UUIDs in theinit_quantaandquantum_datasetscomponents (which must both be complete).Populate the
thin_graphcomponent from thepipeline_graph,quantum_datasetsandquantum_indicescomponents (which must all be complete).update_output_run(output_run)Update the output
RUNcollection name in all datasets and regenerate all output dataset and quantum UUIDs.write(uri, *[, zstd_level, zstd_dict_size, ...])Write the graph to a file.
Attributes Documentation
- dimension_data: DimensionDataAttacher | None = None¶
Object that can attach dimension records to data IDs.
Methods Documentation
- assemble() PredictedQuantumGraph¶
Construct a
PredictedQuantumGraphfrom these components.
- classmethod from_old_quantum_graph(old_quantum_graph: QuantumGraph) PredictedQuantumGraphComponents¶
Construct from an old
QuantumGraphinstance.- Parameters:
- old_quantum_graph
QuantumGraph Quantum graph to transform.
- old_quantum_graph
- Returns:
- components
PredictedQuantumGraphComponents Components for a new predicted quantum graph.
- components
- make_dataset_ref(predicted: PredictedDatasetModel) DatasetRef¶
Make a
lsst.daf.butler.DatasetReffrom information in the predicted quantum graph.- Parameters:
- predicted
PredictedDatasetModel Model for the dataset in the predicted graph.
- predicted
- Returns:
- ref
lsst.daf.butler.DatasetRef A dataset reference. Data ID will be expanded if and only if the dimension data has been loaded.
- ref
- classmethod read_execution_quanta(uri: str | ParseResult | ResourcePath | Path, quantum_ids: Iterable[UUID] | None = None, page_size: int = 5000000) PredictedQuantumGraphComponents¶
Read one or more executable quanta from a quantum graph file.
- Parameters:
- uriconvertible to
lsst.resources.ResourcePath URI to open. Should have a
.qgextension for new quantum graph files, or.qgraphfor the old format.- quantum_ids
Iterable[uuid.UUID], optional Iterable of quantum IDs to load. If not provided, all quanta will be loaded. The UUIDs of special init quanta will be ignored.
- page_size
int, optional Approximate number of bytes to read at once from address files. Note that this does not set a page size for all reads, but it does affect the smallest, most numerous reads.
- uriconvertible to
- Returns:
- components
PredictedQuantumGraphComponents] Components for quantum graph that can build execution quanta for all of the given IDs.
- components
- set_header_counts() None¶
Populate the quantum and dataset counts in the header from the
quantum_indices,thin_graph,init_quanta, andquantum_datasetscomponents.
- set_quantum_indices() None¶
Populate the
quantum_indicescomponent by sorting the UUIDs in theinit_quantaandquantum_datasetscomponents (which must both be complete).
- set_thin_graph() None¶
Populate the
thin_graphcomponent from thepipeline_graph,quantum_datasetsandquantum_indicescomponents (which must all be complete).
- update_output_run(output_run: str) None¶
Update the output
RUNcollection name in all datasets and regenerate all output dataset and quantum UUIDs.
- write(uri: str | ParseResult | ResourcePath | Path, *, zstd_level: int = 10, zstd_dict_size: int = 32768, zstd_dict_n_inputs: int = 512) None¶
Write the graph to a file.
- Parameters:
- uriconvertible to
lsst.resources.ResourcePath Path to write to. Should have a
.qgextension, or.qgraphto force writing the old format.- zstd_level
int, optional ZStandard compression level to use on JSON blocks.
- zstd_dict_size
int, optional Size of a ZStandard dictionary that shares compression information across components. Set to zero to disable the dictionary. Dictionary compression is automatically disabled if the number of quanta is smaller than
zstd_dict_n_inputs.- zstd_dict_n_inputs
int, optional Maximum number of
PredictedQuantumDatasetsModelJSON representations to feed the ZStandard dictionary training routine.
- uriconvertible to
Notes
Only a complete predicted quantum graph with all components fully populated should be written.