ClusteredQuantumGraph¶
- class lsst.ctrl.bps.ClusteredQuantumGraph(name, qgraph, qgraph_filename=None)¶
- Bases: - object- Graph where the data for a node is a subgraph of the full QuantumGraph represented by a list of node ids. - Parameters:
- namestr
- Name to be given to the ClusteredQuantumGraph. 
- qgraphlsst.pipe.base.QuantumGraph
- The QuantumGraph to be clustered. 
- qgraph_filenamestr
- Filename for given QuantumGraph if it has already been serialized. 
 
- name
- Raises:
- ValueError
- Raised if invalid name (e.g., name contains /) 
 
 - Notes - Using lsst.pipe.base.NodeId instead of integer because the QuantumGraph API requires them. Chose skipping the repeated creation of objects to use API over totally minimized memory usage. - Attributes Summary - The name of the ClusteredQuantumGraph. - The QuantumGraph associated with this Clustered QuantumGraph. - Methods Summary - add_cluster(clusters_for_adding)- Add a cluster of quanta as a node in the graph. - add_dependency(parent, child)- Add a directed dependency between a parent cluster and a child - clusters()- Iterate over clusters. - draw(filename[, format_])- Draw the ClusteredQuantumGraph in a given format. - get_cluster(name)- Retrieve a cluster from the ClusteredQuantumGraph by name. - get_quantum_node(id_)- Retrieve a QuantumNode from the ClusteredQuantumGraph by ID. - load(filename[, format_])- Load a ClusteredQuantumGraph from the given file. - predecessors(name)- Return clusters that are predecessors of the cluster with the given name. - save(filename[, format_])- Save the ClusteredQuantumGraph in a format that is loadable. - successors(name)- Return clusters that are successors of the cluster with the given name. - validate()- Check correctness of completed ClusteredQuantumGraph. - Attributes Documentation - name¶
- The name of the ClusteredQuantumGraph. 
 - qgraph¶
- The QuantumGraph associated with this Clustered QuantumGraph. 
 - Methods Documentation - add_cluster(clusters_for_adding)¶
- Add a cluster of quanta as a node in the graph. - Parameters:
- clusters_for_addingQuantaClusterorIterable[QuantaCluster]
- The cluster to be added to the ClusteredQuantumGraph. 
 
- clusters_for_adding
 
 - add_dependency(parent, child)¶
- Add a directed dependency between a parent cluster and a child
- cluster. 
 - Parameters:
- parentstrorQuantaCluster
- Parent cluster. 
- childstrorQuantaCluster
- Child cluster. 
 
- parent
- Raises:
- KeyError
- Raised if either the parent or child doesn’t exist in the ClusteredQuantumGraph. 
 
 
 - clusters()¶
- Iterate over clusters. - Returns:
- clustersIterator[lsst.ctrl.bps.QuantaCluster]
- Iterator over clusters in topological order. 
 
- clusters
 
 - draw(filename, format_=None)¶
- Draw the ClusteredQuantumGraph in a given format. 
 - get_cluster(name)¶
- Retrieve a cluster from the ClusteredQuantumGraph by name. - Parameters:
- namestr
- Name of cluster to retrieve. 
 
- name
- Returns:
- clusterQuantaCluster
- QuantaCluster matching given name. 
 
- cluster
- Raises:
- KeyError
- Raised if the ClusteredQuantumGraph does not contain a cluster with given name. 
 
 
 - get_quantum_node(id_)¶
- Retrieve a QuantumNode from the ClusteredQuantumGraph by ID. - Parameters:
- id_lsst.pipe.base.NodeIdor int
- ID of the QuantumNode to retrieve. 
 
- id_
- Returns:
- quantum_nodelsst.pipe.base.QuantumNode
- QuantumNode matching given ID. 
 
- quantum_node
- Raises:
- KeyError
- Raised if the ClusteredQuantumGraph does not contain a QuantumNode with given ID. 
 
 
 - classmethod load(filename, format_=None)¶
- Load a ClusteredQuantumGraph from the given file. - Parameters:
- Returns:
- ClusteredQuantumGraphlsst.ctrl.bps.ClusteredQuantumGraph
- ClusteredQuantumGraph workflow loaded from the given file. The QuantumGraph is loaded from its own file specified in the saved ClusteredQuantumGraph. 
 
- ClusteredQuantumGraph
 
 - predecessors(name)¶
- Return clusters that are predecessors of the cluster with the given name. - Parameters:
- namestr
- Name of cluster for which need the predecessors. 
 
- name
- Returns:
- clustersIterator[lsst.ctrl.bps.QuantaCluster]
- Iterator over predecessors of given cluster. 
 
- clusters
 
 - save(filename, format_=None)¶
- Save the ClusteredQuantumGraph in a format that is loadable. The QuantumGraph is saved separately if hasn’t already been serialized. 
 - successors(name)¶
- Return clusters that are successors of the cluster with the given name. - Parameters:
- namestr
- Name of cluster for which need the successors. 
 
- name
- Returns:
- clustersIterator[lsst.ctrl.bps.QuantaCluster]
- Iterator over successors of given cluster. 
 
- clusters
 
 - validate()¶
- Check correctness of completed ClusteredQuantumGraph. - Raises:
- RuntimeError
- If the ClusteredQuantumGraph is not valid.