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.
DimensionGroup
behaves in many respects like a set ofstr
dimension names that maintains several special subsets and supersets of related dimension elements. It does not fully implement thecollections.abc.Set
interface, because it defines a few different iteration orders and does not privilege any one of them by implementing__iter__
.- Parameters:
- universe
DimensionUniverse
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
dimensions
andnames
must be provided.- _conform
bool
, optional If
True
(default), expand to include dependencies.False
should only be used for callers that can guarantee that other arguments are already correctly expanded, and is for internal use only.
- universe
Notes
DimensionGroup
should be used instead of other collections in most contexts where a collection of dimensions is required and aDimensionUniverse
is available. Exceptions include cases where order matters (and is different from the consistent ordering defined by theDimensionUniverse
), or completeSet
semantics are required.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
.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
self
are also inother
.issuperset
(other)Test whether all dimensions in
other
are also inself
.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.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
- as_group() DimensionGroup ¶
Return
self
.This is a backwards-compatibility API that allows both
DimensionGraph
andDimensionGroup
to be coerced to the latter.
- intersection(*others: DimensionGroup) DimensionGroup ¶
Construct a new group with only dimensions in all of the operands.
See also
union
.
- isdisjoint(other: DimensionGroup) bool ¶
Test whether the intersection of two groups is empty.
Returns
True
if either operand is the empty.
- issubset(other: DimensionGroup) bool ¶
Test whether all dimensions in
self
are also inother
.Returns
True
ifself
is empty.
- issuperset(other: DimensionGroup) bool ¶
Test whether all dimensions in
other
are also inself
.Returns
True
ifother
is empty.
- union(*others: DimensionGroup) DimensionGroup ¶
Construct a new group with all dimensions in any of the operands.
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.