DimensionGraph¶
- class lsst.daf.butler.DimensionGraph(universe: DimensionUniverse, dimensions: Iterable[Dimension] | None = None, names: Iterable[str] | None = None, conform: bool = True)¶
- 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:
- universeDimensionUniverse
- The special graph of all known dimensions of which this graph will be a subset. 
- dimensionsiterable 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.
- namesiterable of str, optional
- An iterable of the names of dimensions 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.
- conformbool, 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.
 
- universe
 - Notes - DimensionGraphshould be used instead of other collections in most contexts where a collection of dimensions is required and a- DimensionUniverseis available. Exceptions include cases where order matters (and is different from the consistent ordering defined by the- DimensionUniverse), or complete- Setsemantics are required.- Attributes Summary - Set of the names of all dimensions in the graph ( - KeysView).- Return a tuple of all elements in specific order. - Families represented by the spatial elements in this graph. - Families represented by the temporal elements in this graph. - Methods Summary - from_json(json_str[, universe, registry])- Convert from JSON to a pydantic model. - from_simple(names[, universe, registry])- Construct a new object from the simplified form. - get(name[, default])- Return the element with the given name. - intersection(*others)- Construct a new graph with 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.- to_json([minimal])- Convert this class to JSON assuming that the - to_simple()returns a pydantic model.- to_simple([minimal])- Convert this class to a simple python type. - union(*others)- Construct a new graph with all dimensions in any of the operands. - Attributes Documentation - names¶
- Set of the names of all dimensions in the graph ( - KeysView).
 - primaryKeyTraversalOrder¶
- Return a tuple of all elements in specific order. - The 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. 
 - spatial¶
- Families represented by the spatial elements in this graph. 
 - temporal¶
- Families represented by the temporal elements in this graph. 
 - Methods Documentation - classmethod from_json(json_str: str, universe: DimensionUniverse | None = None, registry: Registry | None = None) SupportsSimple¶
- Convert from JSON to a pydantic model. 
 - classmethod from_simple(names: SerializedDimensionGraph, universe: DimensionUniverse | None = None, registry: Registry | None = None) DimensionGraph¶
- Construct a new object from the simplified form. - This is assumed to support data data returned from the - to_simplemethod.- Parameters:
- nameslistofstr
- The names of the dimensions. 
- universeDimensionUniverse
- The special graph of all known dimensions of which this graph will be a subset. Can be - Noneif- Registryis provided.
- registrylsst.daf.butler.Registry, optional
- Registry from which a universe can be extracted. Can be - Noneif universe is provided explicitly.
 
- names
- Returns:
- graphDimensionGraph
- Newly-constructed object. 
 
- graph
 
 - 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: DimensionGraph) DimensionGraph¶
- Construct a new graph with only dimensions in all of the operands. - See also - union.
 - isdisjoint(other: DimensionGraph) bool¶
- Test whether the intersection of two graphs is empty. - Returns - Trueif either operand is the empty.
 - issubset(other: DimensionGraph) bool¶
- Test whether all dimensions in - selfare also in- other.- Returns - Trueif- selfis empty.
 - issuperset(other: DimensionGraph) bool¶
- Test whether all dimensions in - otherare also in- self.- Returns - Trueif- otheris empty.
 - to_json(minimal: bool = False) str¶
- Convert this class to JSON assuming that the - to_simple()returns a pydantic model.
 - to_simple(minimal: bool = False) SerializedDimensionGraph¶
- Convert this class to a simple python type. - This type is suitable for serialization. 
 - union(*others: DimensionGraph) DimensionGraph¶
- Construct a new graph with 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.