DimensionGraph¶
- 
class lsst.daf.butler.DimensionGraph¶
- Bases: - object- An immutable, dependency-complete collection of dimensions. - DimensionGraphbehaves in many respects like a set of- Dimensioninstances that maintains several special subsets and supersets of related- DimensionElementinstances. It does not fully implement the- collections.abc.Setinterface, as its automatic expansion of dependencies would make set difference and XOR operations behave surprisingly.- It also provides dict-like lookup of - DimensionElementinstances from their names.- Parameters: - universe : DimensionUniverse
- The special graph of all known dimensions of which this graph will be a subset. 
- dimensions : iterable of Dimension, optional
- An iterable of - Dimensioninstances that must be included in the graph. All (recursive) dependencies of these dimensions will also be included. At most one of- dimensionsand- namesmust be provided.
- names : iterable of str, optional
- An iterable of the names of dimensiosn that must be included in the graph. All (recursive) dependencies of these dimensions will also be included. At most one of - dimensionsand- namesmust be provided.
- conform : bool, optional
- If - True(default), expand to include dependencies.- Falseshould only be used for callers that can guarantee that other arguments are already correctly expanded, and is primarily for internal use.
 - Notes - DimensionGraphshould be used instead of other collections in any context where a collection of dimensions is required and a- DimensionUniverseis available.- While - DimensionUniverseinherits from- DimensionGraph, it should otherwise not be used as a base class.- Attributes Summary - names- A set of the names of all dimensions in the graph ( - KeysView).- primaryKeyTraversalOrder- Return a tuple of all elements in an order allows records to be found given their primary keys, starting from only the primary keys of required dimensions ( - tuple[- DimensionRecord]).- Methods Summary - decode(encoded, *, universe)- Construct a - DimensionGraphfrom its encoded representation.- encode()- Encode a - DimensionGraphinto a byte string.- get(name, default)- Return the element with the given name. - intersection(*others)- Construct a new graph containing only dimensions in all of the operands. - isdisjoint(other)- Test whether the intersection of two graphs is empty. - issubset(other)- Test whether all dimensions in - selfare also in- other.- issuperset(other)- Test whether all dimensions in - otherare also in- self.- union(*others)- Construct a new graph containing all dimensions in any of the operands. - Attributes Documentation - 
names¶
- A set of the names of all dimensions in the graph ( - KeysView).
 - 
primaryKeyTraversalOrder¶
- Return a tuple of all elements in an order allows records to be found given their primary keys, starting from only the primary keys of required dimensions ( - tuple[- DimensionRecord]).- Unlike the table definition/topological order (which is what DimensionUniverse.sorted gives you), when dimension A implies dimension B, dimension A appears first. 
 - Methods Documentation - 
classmethod decode(encoded: bytes, *, universe: DimensionUniverse) → DimensionGraph¶
- Construct a - DimensionGraphfrom its encoded representation.- Parameters: - encoded : bytes
- Byte string produced by - DimensionGraph.encode.
- universe : DimensionUniverse
- Universe the new graph is a part of. Must have the same dimensions as the original universe. 
 - Returns: - graph : DimensionGraph
- A new (or possibly cached) - DimensionGraphinstance matching the given encoding.
 
- encoded : 
 - 
encode() → bytes¶
- Encode a - DimensionGraphinto a byte string.- Returns: - encoded : bytes
- Encoded representation of the graph. Length is guaranteed to be equal to - DimensionUniverse.getEncodeLength.
 
- encoded : 
 - 
get(name: str, default: Any = None) → DimensionElement¶
- Return the element with the given name. - This lookup covers all - DimensionElementinstances in- self.elements, not just true- Dimensioninstances).
 - 
intersection(*others)¶
- Construct a new graph containing only dimensions in all of the operands. 
 - 
isdisjoint(other: lsst.daf.butler.core.dimensions.graph.DimensionGraph) → bool¶
- Test whether the intersection of two graphs is empty. - Returns - Trueif either operand is the empty.
 - 
issubset(other: lsst.daf.butler.core.dimensions.graph.DimensionGraph) → bool¶
- Test whether all dimensions in - selfare also in- other.- Returns - Trueif- selfis empty.
 - 
issuperset(other: lsst.daf.butler.core.dimensions.graph.DimensionGraph) → bool¶
- Test whether all dimensions in - otherare also in- self.- Returns - Trueif- otheris empty.
 - 
union(*others)¶
- Construct a new graph containing all dimensions in any of the operands. - The elements of the returned graph may exceed the naive union of their elements, as some - DimensionElementinstances are included in graphs whenever multiple dimensions are present, and those dependency dimensions could have been provided by different operands.
 
- universe :