DimensionNameSet¶
-
class
lsst.daf.butler.
DimensionNameSet
(names)¶ Bases:
lsst.daf.butler.core.dimensions.sets.DimensionSetBase
An incomplete, name-only stand-in for
DimensionSet
orDimensionGraph
.Parameters: - names : iterable of
str
The names of elements to conceptually include in the set.
Notes
Because true
DimensionSet
s andDimensionGraph
s cannot be constructed without access to a “universe”DimensionGraph
loaded from config, requiring one of these classes in API also makes that API more difficult to use.DimensionNameSet
partially solves that problem by being easy to construct (only the names of theDimensionElement
s are needed, and no sorting or checking is done) and behaving as much like aDimensionSet
orDimensionGraph
as possible. This enables the following pattern:- Accept either
DimensionNameSet
as well asDimensionSet
and/orDimensionGraph
when construting objects that need a container ofDimensionElement
s. This may limit the functionality of the constructed object if only aDimensionNameSet
is passed, of course. - “Upgrade” from
DimensionNameSet
to 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
DatasetType
class provides an example of this pattern;DatasetType
s may be constructed with only the names ofDimension
s, but are modified transparently byRegistry
operations to hold actualDimension
objects.Attributes Summary
names
The names of all elements ( set
-like, immutable).Methods Summary
difference
(other)Return a new set containing all elements that are in self
but not other.intersection
(*others)Return a new set containing all elements that are in both self
and all of the other given sets.isdisjoint
(other)Return True
if there are no elements in bothself
andother
, andFalse
otherwise.issubset
(other)Return True
if all elements inself
are also inother
.issuperset
(other)Return True
if all elements inother
are also inself
, andFalse
otherwise.symmetric_difference
(other)Return a new set containing all elements that are in either self
or other, but not both.union
(*others)Return a new set containing all elements that are in self
or any of the other given sets.Attributes Documentation
-
names
¶ The names of all elements (
set
-like, immutable).Unlike a real
DimensionElement
container, these names are not topologically sorted.
Methods Documentation
-
difference
(other)¶ Return a new set containing all elements that are in
self
but not other.Parameters: - other : iterable of
DimensionElement
orstr
. The other set containing elements that should not be included in the result.
Returns: - result :
DimensionNameSet
orDimensionSet
A new set containing elements in
self
but notother
. A fullDimensionSet
is returned if any argument is a fullDimensionSet
orDimensionGraph
.
- other : iterable of
-
intersection
(*others)¶ Return a new set containing all elements that are in both
self
and all of the other given sets.Parameters: - others : iterable over
DimensionElement
orstr
. Other sets whose elements may be included in the result.
Returns: - result :
DimensionNameSet
orDimensionSet
A new set containing any elements in all input sets. A full
DimensionSet
is returned if any argument is a fullDimensionSet
orDimensionGraph
.
- others : iterable over
-
isdisjoint
(other)¶ Return
True
if there are no elements in bothself
andother
, andFalse
otherwise.All sets (including the empty set) are disjoint with the empty set.
-
issubset
(other)¶ Return
True
if all elements inself
are also inother
.The empty set is a subset of all sets (including the empty set).
-
issuperset
(other)¶ Return
True
if all elements inother
are also inself
, andFalse
otherwise.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
self
or other, but not both.Parameters: - other : iterable of
DimensionElement
orstr
. The other set from which to draw potential result elements.
Returns: - result :
DimensionNameSet
orDimensionSet
A new set containing elements
self
orother
, but not both. A fullDimensionSet
is returned if any argument is a fullDimensionSet
orDimensionGraph
.
- other : iterable of
-
union
(*others)¶ Return a new set containing all elements that are in
self
or any of the other given sets.Parameters: - *others : iterable over
DimensionElement
orstr
. Other sets whose elements should be included in the result.
Returns: - result :
DimensionNameSet
orDimensionSet
A new set containing all elements in any input set. A full
DimensionSet
is returned if any argument is a fullDimensionSet
orDimensionGraph
.
- *others : iterable over
- names : iterable of