DimensionNameSet¶
-
class
lsst.daf.butler.DimensionNameSet(names)¶ Bases:
lsst.daf.butler.core.dimensions.sets.DimensionSetBaseAn incomplete, name-only stand-in for
DimensionSetorDimensionGraph.Parameters: - names : iterable of
str The names of elements to conceptually include in the set.
Notes
Because true
DimensionSets andDimensionGraphs cannot be constructed without access to a “universe”DimensionGraphloaded from config, requiring one of these classes in API also makes that API more difficult to use.DimensionNameSetpartially solves that problem by being easy to construct (only the names of theDimensionElements are needed, and no sorting or checking is done) and behaving as much like aDimensionSetorDimensionGraphas possible. This enables the following pattern:- Accept either
DimensionNameSetas well asDimensionSetand/orDimensionGraphwhen construting objects that need a container ofDimensionElements. This may limit the functionality of the constructed object if only aDimensionNameSetis passed, of course. - “Upgrade” from
DimensionNameSetto one of the more complete classes when the object is rendezvouzed with a “universe”DimensionGraph. This upgrade process also serves to validate the names.
The
DatasetTypeclass provides an example of this pattern;DatasetTypes may be constructed with only the names ofDimensions, but are modified transparently byRegistryoperations to hold actualDimensionobjects.Attributes Summary
namesThe names of all elements ( set-like, immutable).Methods Summary
difference(other)Return a new set containing all elements that are in selfbut not other.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 bothselfandother, andFalseotherwise.issubset(other)Return Trueif all elements inselfare also inother.issuperset(other)Return Trueif all elements inotherare also inself, andFalseotherwise.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).Unlike a real
DimensionElementcontainer, these names are not topologically sorted.
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 notother. A fullDimensionSetis returned if any argument is a fullDimensionSetorDimensionGraph.
- other : iterable of
-
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 fullDimensionSetorDimensionGraph.
- others : iterable over
-
isdisjoint(other)¶ Return
Trueif there are no elements in bothselfandother, andFalseotherwise.All sets (including the empty set) are disjoint with the empty set.
-
issubset(other)¶ Return
Trueif all elements inselfare also inother.The empty set is a subset of all sets (including the empty set).
-
issuperset(other)¶ Return
Trueif all elements inotherare also inself, andFalseotherwise.All sets (including the empty set) are supersets of the empty set.
-
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
selforother, but not both. A fullDimensionSetis returned if any argument is a fullDimensionSetorDimensionGraph.
- 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 fullDimensionSetorDimensionGraph.
- *others : iterable over
- names : iterable of