DataCoordinateSet

class lsst.daf.butler.DataCoordinateSet(dataIds: Set[DataCoordinate], graph: DimensionGraph | None = None, *, dimensions: Iterable[str] | DimensionGroup | DimensionGraph | None = None, hasFull: bool | None = None, hasRecords: bool | None = None, check: bool = True, universe: DimensionUniverse | None = None)

Bases: _DataCoordinateCollectionBase

Iterable iteration that is set-like.

A DataCoordinateIterable implementation that adds some set-like functionality, and is backed by a true set-like object.

Parameters:
dataIdscollections.abc.Set [ DataCoordinate ]

A set of DataCoordinate instances, with dimensions equal to graph. If this is a mutable object, the caller must be able to guarantee that it will not be modified by any other holders.

graphDimensionGraph, optional

Dimensions identified by all data IDs in the collection. Ignored if dimensions is provided, and deprecated with removal after v27.

dimensionsIterable [ str ], DimensionGroup, or DimensionGraph, optional

Dimensions identified by all data IDs in the collection. Must be provided unless graph is.

hasFullbool, optional

If True, the caller guarantees that DataCoordinate.hasFull returns True for all given data IDs. If False, no such guarantee is made, and DataCoordinateSet.hasFull will always return False. If None (default), DataCoordinateSet.hasFull will be computed from the given data IDs, immediately if check is True, or on first use if check is False.

hasRecordsbool, optional

If True, the caller guarantees that DataCoordinate.hasRecords returns True for all given data IDs. If False, no such guarantee is made and DataCoordinateSet.hasRecords will always return False. If None (default), DataCoordinateSet.hasRecords will be computed from the given data IDs, immediately if check is True, or on first use if check is False.

checkbool, optional

If True (default) check that all data IDs are consistent with the given graph and state flags at construction. If False, no checking will occur.

universeDimensionUniverse

Object that manages all dimension definitions.

Notes

DataCoordinateSet does not formally implement the collections.abc.Set interface, because that requires many binary operations to accept any set-like object as the other argument (regardless of what its elements might be), and it’s much easier to ensure those operations never behave surprisingly if we restrict them to DataCoordinateSet or (sometimes) DataCoordinateIterable, and in most cases restrict that they identify the same dimensions. In particular:

In addition, when the two operands differ in the return values of hasFull and/or hasRecords, we make no guarantees about what those methods will return on the new DataCoordinateSet (other than that they will accurately reflect what elements are in the new set - we just don’t control which elements are contributed by each operand).

Methods Summary

difference(other)

Return a new set with all data IDs in this that are not in other.

intersection(other)

Return a new set that contains all data IDs from parameters.

isdisjoint(other)

Test whether there are no data IDs in both self and other.

issubset(other)

Test whether self contains all data IDs in other.

issuperset(other)

Test whether other contains all data IDs in self.

subset(dimensions)

Return a set whose data IDs identify a subset.

symmetric_difference(other)

Return a new set with all data IDs in either parameters, not both.

toSet()

Transform this iterable into a DataCoordinateSet.

union(other)

Return a new set that contains all data IDs in either parameters.

Methods Documentation

difference(other: DataCoordinateIterable) DataCoordinateSet

Return a new set with all data IDs in this that are not in other.

Parameters:
otherDataCoordinateIterable

An iterable of data IDs with other.dimensions == self.dimensions.

Returns:
intersectionDataCoordinateSet

A new DataCoordinateSet instance.

intersection(other: DataCoordinateIterable) DataCoordinateSet

Return a new set that contains all data IDs from parameters.

Parameters:
otherDataCoordinateIterable

An iterable of data IDs with other.dimensions == self.dimensions.

Returns:
intersectionDataCoordinateSet

A new DataCoordinateSet instance.

isdisjoint(other: DataCoordinateIterable) bool

Test whether there are no data IDs in both self and other.

Parameters:
otherDataCoordinateIterable

An iterable of data IDs with other._dimensions == self._dimensions.

Returns:
isdisjointbool

True if there are no data IDs in both self and other, and False otherwise.

issubset(other: DataCoordinateIterable) bool

Test whether self contains all data IDs in other.

Parameters:
otherDataCoordinateIterable

An iterable of data IDs with other.graph == self.graph.

Returns:
issubsetbool

True if all data IDs in self are also in other, and False otherwise.

issuperset(other: DataCoordinateIterable) bool

Test whether other contains all data IDs in self.

Parameters:
otherDataCoordinateIterable

An iterable of data IDs with other.dimensions == self.dimensions.

Returns:
issupersetbool

True if all data IDs in other are also in self, and False otherwise.

subset(dimensions: DimensionGraph | DimensionGroup | Iterable[str]) DataCoordinateSet

Return a set whose data IDs identify a subset.

Parameters:
dimensionsDimensionGraph, DimensionGroup, or Iterable [ str ]

Dimensions to be identified by the data IDs in the returned iterable. Must be a subset of self.dimensions.

Returns:
setDataCoordinateSet

A DataCoordinateSet with set.dimensions == dimensions. Will be self if dimensions == self.dimensions. Elements are equivalent to those that would be created by calling DataCoordinate.subset on all elements in self, with deduplication and in arbitrary order.

symmetric_difference(other: DataCoordinateIterable) DataCoordinateSet

Return a new set with all data IDs in either parameters, not both.

Parameters:
otherDataCoordinateIterable

An iterable of data IDs with other.dimensions == self.dimensions.

Returns:
intersectionDataCoordinateSet

A new DataCoordinateSet instance.

toSet() DataCoordinateSet

Transform this iterable into a DataCoordinateSet.

Returns:
setDataCoordinateSet

A DatasetCoordinateSet instance with the same elements as self, after removing any duplicates. May be self if it is already a DataCoordinateSet.

union(other: DataCoordinateIterable) DataCoordinateSet

Return a new set that contains all data IDs in either parameters.

Parameters:
otherDataCoordinateIterable

An iterable of data IDs with other.dimensions == self.dimensions.

Returns:
intersectionDataCoordinateSet

A new DataCoordinateSet instance.