DimensionNameSet

class lsst.daf.butler.DimensionNameSet(names)

Bases: lsst.daf.butler.core.dimensions.sets.DimensionSetBase

An incomplete, name-only stand-in for DimensionSet or DimensionGraph.

Parameters:
names : iterable of str

The names of elements to conceptually include in the set.

Notes

Because true DimensionSets and DimensionGraphs 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 the DimensionElements are needed, and no sorting or checking is done) and behaving as much like a DimensionSet or DimensionGraph as possible. This enables the following pattern:

The DatasetType class provides an example of this pattern; DatasetTypes may be constructed with only the names of Dimensions, but are modified transparently by Registry operations to hold actual Dimension 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 both self and other, and False otherwise.
issubset(other) Return True if all elements in self are also in other.
issuperset(other) Return True if all elements in other are also in self, and False 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 or str.

The other set containing elements that should not be included in the result.

Returns:
result : DimensionNameSet or DimensionSet

A new set containing elements in self but not other. A full DimensionSet is returned if any argument is a full DimensionSet or DimensionGraph.

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 or str.

Other sets whose elements may be included in the result.

Returns:
result : DimensionNameSet or DimensionSet

A new set containing any elements in all input sets. A full DimensionSet is returned if any argument is a full DimensionSet or DimensionGraph.

isdisjoint(other)

Return True if there are no elements in both self and other, and False otherwise.

All sets (including the empty set) are disjoint with the empty set.

issubset(other)

Return True if all elements in self are also in other.

The empty set is a subset of all sets (including the empty set).

issuperset(other)

Return True if all elements in other are also in self, and False 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 or str.

The other set from which to draw potential result elements.

Returns:
result : DimensionNameSet or DimensionSet

A new set containing elements self or other, but not both. A full DimensionSet is returned if any argument is a full DimensionSet or DimensionGraph.

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 or str.

Other sets whose elements should be included in the result.

Returns:
result : DimensionNameSet or DimensionSet

A new set containing all elements in any input set. A full DimensionSet is returned if any argument is a full DimensionSet or DimensionGraph.