DimensionGroup¶
- class lsst.daf.butler.DimensionGroup(universe: DimensionUniverse, names: Iterable[str] | DimensionGroup = frozenset({}), _conform: bool = True)¶
- Bases: - object- An immutable, dependency-complete collection of dimensions. - DimensionGroupbehaves in many respects like a set of- strdimension names that maintains several special subsets and supersets of related dimension elements. It does not fully implement the- collections.abc.Setinterface, because it defines a few different iteration orders and does not privilege any one of them by implementing- __iter__.- Parameters:
- universeDimensionUniverse
- Object that manages all known dimensions. 
- namesiterable of str, optional
- An iterable of the names of dimensions that must be included in the group. 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 for internal use only.
 
- universe
 - Notes - DimensionGroupshould 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.- This class is not a Pydantic model, but it implements the - __get_pydantic_core_schema__special method and hence can be used as a field in Pydantic models or [de]serialized directly via- pydantic.TypeAdapter, but validation requires a- DimensionUniverseto be passed as the “universe” key in the Pydantic validation context. The- pydantic_utils.DeferredValidationclass can be used to defer validation of this object or other types that use it until that context is available.- Attributes Summary - A set of dimensions ordered like - DataCoordinate.mapping.- A tuple of all elements in the order needed to find their records. - Families represented by the spatial elements in this graph. - Families represented by the temporal elements in this graph. - Methods Summary - as_group()- Return - self.- from_simple(data, universe)- Create an instance of this class from serialized data. - intersection(*others)- Construct a new group with only dimensions in all of the operands. - isdisjoint(other)- Test whether the intersection of two groups is empty. - issubset(other)- Test whether all dimensions in - selfare also in- other.- issuperset(other)- Test whether all dimensions in - otherare also in- self.- Convert this class to a simple data format suitable for serialization. - union(*others)- Construct a new group with all dimensions in any of the operands. - Attributes Documentation - data_coordinate_keys¶
- A set of dimensions ordered like - DataCoordinate.mapping.- This order is defined as all required dimensions followed by all implied dimensions. 
 - lookup_order¶
- A tuple of all elements in the order needed to find their records. - Unlike the table definition/topological order (which is what - DimensionUniverse.sortedgives 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 - as_group() DimensionGroup¶
- Return - self.- Returns:
- groupDimensionGroup
- Returns itself. 
 
- group
 - Notes - This is a backwards-compatibility API that allowed both the old - DimensionGraphclass and- DimensionGroupto be coerced to the latter.- Deprecated since version v28: Deprecated as no longer necessary (this method always returns ‘self’). Will be removed after v28. 
 - classmethod from_simple(data: SerializedDimensionGroup, universe: DimensionUniverse) DimensionGroup¶
- Create an instance of this class from serialized data. - Parameters:
- dataSerializedDimensionGroup
- Serialized data from a previous call to - to_simple.
- universeDimensionUniverse
- Dimension universe in which this dimension group will be defined. 
 
- data
 
 - intersection(*others: DimensionGroup) DimensionGroup¶
- Construct a new group with only dimensions in all of the operands. - Parameters:
- *othersDimensionGroup
- Other groups to compare with. 
 
- *others
- Returns:
- interDimensionGroup
- Intersection of all the groups. 
 
- inter
 - Notes - See also - union.
 - isdisjoint(other: DimensionGroup) bool¶
- Test whether the intersection of two groups is empty. - Parameters:
- otherDimensionGroup
- Other group to compare with. 
 
- other
- Returns:
 
 - issubset(other: DimensionGroup) bool¶
- Test whether all dimensions in - selfare also in- other.- Parameters:
- otherDimensionGroup
- Other group to compare with. 
 
- other
- Returns:
 
 - issuperset(other: DimensionGroup) bool¶
- Test whether all dimensions in - otherare also in- self.- Parameters:
- otherDimensionGroup
- Other group to compare with. 
 
- other
- Returns:
 
 - union(*others: DimensionGroup) DimensionGroup¶
- Construct a new group with all dimensions in any of the operands. - Parameters:
- *othersDimensionGroup
- Other groups to join with. 
 
- *others
- Returns:
- unionDimensionGroup
- Union of all the groups. 
 
- union
 - Notes - The elements of the returned group may exceed the naive union of their elements, as some dimension elements are included in groups whenever multiple dimensions are present, and those dependency dimensions could have been provided by different operands.