DimensionSet¶
- 
class lsst.daf.butler.DimensionSet(universe, elements, expand=False, implied=False)¶
- Bases: - lsst.daf.butler.core.dimensions.sets.DimensionSetBase,- collections.abc.Set- A custom set/dict hybrid class for collections of - DimensionElements.- DimensionSetobjects implement the full (immutable)- collections.abc.Setinterface. In addition, like- frozenset, they are immutable and hashable, and also provide named-method versions of most operators. Unlike Python sets, they are deterministically sorted.- Parameters: - universe : DimensionGraph
- Ultimate-parent - DimensionGraphthat constructed the elements in this set.
- elements : iterable of DimensionElementorstr
- Elements to include in the set, or names thereof. 
- expand : bool
- If - True, recursively expand the set to include dependencies.
- implied : bool
- If - True, include implied dependencies in expansion. Ignored if- expandis- False.
 - Raises: - ValidationError
- Raised if a Dimension is not part of the Universe. 
 - Notes - DimensionSetcomparison operators and named-method relation operations accept other set-like objects and iterables containing either- DimensionElementinstances or their string names; because- DimensionElements cannot be directly constructed, APIs that accept them should generally accept a name as an alternative when the transformation to a- DimensionElementcan be done internally. Operators that return new sets (- |,- &,- ^, and- -) do require- DimensionSetoperands on both sides to avoid surprises in return types.- Because the - DimensionElementobjects they hold always have a name,- DimensionSets also supports some- dict-like operations: including regular square-bracket indexing (- __getitem__),- get, and the- inoperator (- __contains__). Both names and- DimensionElementobjects can be passed to any of these. The- namesattribute can also be used to obtain a- set-like object containing those names.- DimensionSetinstances cannot be constructed directly; they can only be obtained (possibly indirectly) from a special “universe”- DimensionGraphloaded from configuration.- Attributes Summary - names- The names of all elements ( - set-like, immutable).- universe- The graph of all dimensions compatible with self ( - DimensionGraph).- Methods Summary - difference(other)- Return a new set containing all elements that are in - selfbut not other.- expanded([implied])- Return a new - DimensionSetthat has been expanded to include dependencies.- findIf(predicate[, default])- Return the element in - selfthat matches the given predicate.- get(key[, default])- Return the element with the given name, or - defaultif it does not exist.- intersection(*others)- Return a new set containing all elements that are in both - selfand all of the other given sets.- isdisjoint(other)- Return - Trueif there are no elements in both- selfand- other, and- Falseotherwise.- issubset(other)- Return - Trueif all elements in- selfare also in- other.- issuperset(other)- Return - Trueif all elements in- otherare also in- self, and- Falseotherwise.- links()- Return the names of all fields that uniquely identify these dimensions in a data ID dict. - symmetric_difference(other)- Return a new set containing all elements that are in either - selfor other, but not both.- union(*others)- Return a new set containing all elements that are in - selfor any of the other given sets.- Attributes Documentation - 
names¶
- The names of all elements ( - set-like, immutable).- The order of the names is consistent with the iteration order of the - DimensionSetitself.
 - 
universe¶
- The graph of all dimensions compatible with self ( - DimensionGraph).
 - Methods Documentation - 
difference(other)¶
- Return a new set containing all elements that are in - selfbut not other.- Parameters: - other : iterable of DimensionElementorstr.
- The other set containing elements that should not be included in the result. 
 - Returns: - result : DimensionNameSetorDimensionSet
- A new set containing elements in - selfbut not- other. A full- DimensionSetis returned if any argument is a full- DimensionSetor- DimensionGraph.
 
- other : iterable of 
 - 
expanded(implied=False)¶
- Return a new - DimensionSetthat has been expanded to include dependencies.- Parameters: - implied : bool
- Whether to include implied as well as required dependencies. 
 
- implied : 
 - 
findIf(predicate, default=None)¶
- Return the element in - selfthat matches the given predicate.- Parameters: - predicate : callable
- Callable that takes a single - DimensionElementargument and returns a- bool, indicating whether the given value should be returned.
- default : DimensionElement, optional
- Object to return if no matching elements are found. 
 - Returns: - matching : DimensionElement
- Element matching the given predicate. 
 - Raises: - ValueError
- Raised if multiple elements match the given predicate. 
 
 - 
get(key, default=None)¶
- Return the element with the given name, or - defaultif it does not exist.- keymay also be a- DimensionElement, in which case an equivalent object will be returned if it is present in the set.
 - 
intersection(*others)¶
- Return a new set containing all elements that are in both - selfand all of the other given sets.- Parameters: - others : iterable over DimensionElementorstr.
- Other sets whose elements may be included in the result. 
 - Returns: - result : DimensionNameSetorDimensionSet
- A new set containing any elements in all input sets. A full - DimensionSetis returned if any argument is a full- DimensionSetor- DimensionGraph.
 
- others : iterable over 
 - 
isdisjoint(other)¶
- Return - Trueif there are no elements in both- selfand- other, and- Falseotherwise.- All sets (including the empty set) are disjoint with the empty set. 
 - 
issubset(other)¶
- Return - Trueif all elements in- selfare also in- other.- The empty set is a subset of all sets (including the empty set). 
 - 
issuperset(other)¶
- Return - Trueif all elements in- otherare also in- self, and- Falseotherwise.- All sets (including the empty set) are supersets of the empty set. 
 - 
links()¶
- Return the names of all fields that uniquely identify these dimensions in a data ID dict. - Returns: 
 - 
symmetric_difference(other)¶
- Return a new set containing all elements that are in either - selfor other, but not both.- Parameters: - other : iterable of DimensionElementorstr.
- The other set from which to draw potential result elements. 
 - Returns: - result : DimensionNameSetorDimensionSet
- A new set containing elements - selfor- other, but not both. A full- DimensionSetis returned if any argument is a full- DimensionSetor- DimensionGraph.
 
- other : iterable of 
 - 
union(*others)¶
- Return a new set containing all elements that are in - selfor any of the other given sets.- Parameters: - *others : iterable over DimensionElementorstr.
- Other sets whose elements should be included in the result. 
 - Returns: - result : DimensionNameSetorDimensionSet
- A new set containing all elements in any input set. A full - DimensionSetis returned if any argument is a full- DimensionSetor- DimensionGraph.
 
- *others : iterable over 
 
- universe :