DataCoordinateSet¶
- 
class lsst.daf.butler.DataCoordinateSet(dataIds: AbstractSet[lsst.daf.butler.core.dimensions._coordinate.DataCoordinate], graph: lsst.daf.butler.core.dimensions._graph.DimensionGraph, *, hasFull: Optional[bool] = None, hasRecords: Optional[bool] = None, check: bool = True)¶
- Bases: - lsst.daf.butler.core.dimensions._dataCoordinateIterable._DataCoordinateCollectionBase- A - DataCoordinateIterableimplementation that adds some set-like functionality, and is backed by a true set-like object.- Parameters: - dataIds : collections.abc.Set[DataCoordinate]
- A set of - DataCoordinateinstances, 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.
- graph : DimensionGraph
- Dimensions identified by all data IDs in the set. 
- hasFull : bool, optional
- If - True, the caller guarantees that- DataCoordinate.hasFullreturns- Truefor all given data IDs. If- False, no such guarantee is made, and- DataCoordinateSet.hasFullwill always return- False. If- None(default),- DataCoordinateSet.hasFullwill be computed from the given data IDs, immediately if- checkis- True, or on first use if- checkis- False.
- hasRecords : bool, optional
- If - True, the caller guarantees that- DataCoordinate.hasRecordsreturns- Truefor all given data IDs. If- False, no such guarantee is made and- DataCoordinateSet.hasRecordswill always return- False. If- None(default),- DataCoordinateSet.hasRecordswill be computed from the given data IDs, immediately if- checkis- True, or on first use if- checkis- False.
- check: `bool`, optional
- If - True(default) check that all data IDs are consistent with the given- graphand state flags at construction. If- False, no checking will occur.
 - Notes - DataCoordinateSetdoes not formally implement the- collections.abc.Setinterface, 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- DataCoordinateSetor (sometimes)- DataCoordinateIterable, and in most cases restrict that they identify the same dimensions. In particular:- a DataCoordinateSetwill compare as not equal to any object that is not aDataCoordinateSet, even native Python sets containing the exact same elements;
- subset/superset comparison _operators_ (<,>,<=,>=) require both operands to beDataCoordinateSetinstances that have the same dimensions (i.e.graphattribute);
- issubset,- issuperset, and- isdisjointrequire the other argument to be a- DataCoordinateIterablewith the same dimensions;
- operators that create new sets (&,|,^,-) require both operands to beDataCoordinateSetinstances that have the same dimensions _and_ the samedtype;
- named methods that create new sets (intersection,union,symmetric_difference,difference) require the other operand to be aDataCoordinateIterablewith the same dimensions _and_ the samedtype.
 - In addition, when the two operands differ in the return values of - hasFulland/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).- Attributes Summary - graph- The dimensions identified by these data IDs ( - DimensionGraph).- universe- The universe that defines all known dimensions compatible with this iterable ( - DimensionUniverse).- Methods Summary - constrain(query, columns, …)- Constrain a SQL query to include or relate to only data IDs in this iterable. - difference(other)- Return a new set that contains all data IDs in - selfthat are not in- other.- fromScalar(dataId)- Return a - DataCoordinateIterablecontaining the single data ID given.- hasFull()- Return whether all data IDs in this iterable identify all dimensions, not just required dimensions. - hasRecords()- Return whether all data IDs in this iterable contain - DimensionRecordinstances.- intersection(other)- Return a new set that contains all data IDs in both - selfand- other.- isdisjoint(other)- Test whether there are no data IDs in both - selfand- other.- issubset(other)- Test whether - selfcontains all data IDs in- other.- issuperset(other)- Test whether - othercontains all data IDs in- self.- subset(graph)- Return a set whose data IDs identify a subset of the dimensions that this one’s do. - symmetric_difference(other)- Return a new set that contains all data IDs in either - selfor- other, but not both.- toSequence()- Transform this iterable into a - DataCoordinateSequence.- toSet()- Transform this iterable into a - DataCoordinateSet.- union(other)- Return a new set that contains all data IDs in either - selfor- other.- Attributes Documentation - 
graph¶
- The dimensions identified by these data IDs ( - DimensionGraph).
 - 
universe¶
- The universe that defines all known dimensions compatible with this iterable ( - DimensionUniverse).
 - Methods Documentation - 
constrain(query: lsst.daf.butler.core.simpleQuery.SimpleQuery, columns: Callable[[str], sqlalchemy.sql.elements.ColumnElement]) → None¶
- Constrain a SQL query to include or relate to only data IDs in this iterable. - Parameters: - query : SimpleQuery
- Struct that represents the SQL query to constrain, either by appending to its WHERE clause, joining a new table or subquery, or both. 
- columns : Callable
- A callable that accepts - strdimension names and returns SQLAlchemy objects representing a column for that dimension’s primary key value in the query.
 
- query : 
 - 
difference(other: lsst.daf.butler.core.dimensions._dataCoordinateIterable.DataCoordinateIterable) → lsst.daf.butler.core.dimensions._dataCoordinateIterable.DataCoordinateSet¶
- Return a new set that contains all data IDs in - selfthat are not in- other.- Parameters: - other : DataCoordinateIterable
- An iterable of data IDs with - other.graph == self.graph.
 - Returns: - intersection : DataCoordinateSet
- A new - DataCoordinateSetinstance.
 
- other : 
 - 
static fromScalar(dataId: lsst.daf.butler.core.dimensions._coordinate.DataCoordinate) → lsst.daf.butler.core.dimensions._dataCoordinateIterable._ScalarDataCoordinateIterable¶
- Return a - DataCoordinateIterablecontaining the single data ID given.- Parameters: - dataId : DataCoordinate
- Data ID to adapt. Must be a true - DataCoordinateinstance, not an arbitrary mapping. No runtime checking is performed.
 - Returns: - iterable : DataCoordinateIterable
- A - DataCoordinateIterableinstance of unspecified (i.e. implementation-detail) subclass. Guaranteed to implement the- collections.abc.Sized(i.e.- __len__) and- collections.abc.Container(i.e.- __contains__) interfaces as well as that of- DataCoordinateIterable.
 
- dataId : 
 - 
hasFull() → bool¶
- Return whether all data IDs in this iterable identify all dimensions, not just required dimensions. - Returns: 
 - 
hasRecords() → bool¶
- Return whether all data IDs in this iterable contain - DimensionRecordinstances.- Returns: 
 - 
intersection(other: lsst.daf.butler.core.dimensions._dataCoordinateIterable.DataCoordinateIterable) → lsst.daf.butler.core.dimensions._dataCoordinateIterable.DataCoordinateSet¶
- Return a new set that contains all data IDs in both - selfand- other.- Parameters: - other : DataCoordinateIterable
- An iterable of data IDs with - other.graph == self.graph.
 - Returns: - intersection : DataCoordinateSet
- A new - DataCoordinateSetinstance.
 
- other : 
 - 
isdisjoint(other: lsst.daf.butler.core.dimensions._dataCoordinateIterable.DataCoordinateIterable) → bool¶
- Test whether there are no data IDs in both - selfand- other.- Parameters: - other : DataCoordinateIterable
- An iterable of data IDs with - other.graph == self.graph.
 - Returns: 
- other : 
 - 
issubset(other: lsst.daf.butler.core.dimensions._dataCoordinateIterable.DataCoordinateIterable) → bool¶
- Test whether - selfcontains all data IDs in- other.- Parameters: - other : DataCoordinateIterable
- An iterable of data IDs with - other.graph == self.graph.
 - Returns: 
- other : 
 - 
issuperset(other: lsst.daf.butler.core.dimensions._dataCoordinateIterable.DataCoordinateIterable) → bool¶
- Test whether - othercontains all data IDs in- self.- Parameters: - other : DataCoordinateIterable
- An iterable of data IDs with - other.graph == self.graph.
 - Returns: 
- other : 
 - 
subset(graph: lsst.daf.butler.core.dimensions._graph.DimensionGraph) → lsst.daf.butler.core.dimensions._dataCoordinateIterable.DataCoordinateSet¶
- Return a set whose data IDs identify a subset of the dimensions that this one’s do. - Parameters: - graph : DimensionGraph
- Dimensions to be identified by the data IDs in the returned iterable. Must be a subset of - self.graph.
 - Returns: - set : DataCoordinateSet
- A - DataCoordinateSetwith- set.graph == graph. Will be- selfif- graph == self.graph. Elements are equivalent to those that would be created by calling- DataCoordinate.subseton all elements in- self, with deduplication but and in arbitrary order.
 
- graph : 
 - 
symmetric_difference(other: lsst.daf.butler.core.dimensions._dataCoordinateIterable.DataCoordinateIterable) → lsst.daf.butler.core.dimensions._dataCoordinateIterable.DataCoordinateSet¶
- Return a new set that contains all data IDs in either - selfor- other, but not both.- Parameters: - other : DataCoordinateIterable
- An iterable of data IDs with - other.graph == self.graph.
 - Returns: - intersection : DataCoordinateSet
- A new - DataCoordinateSetinstance.
 
- other : 
 - 
toSequence() → lsst.daf.butler.core.dimensions._dataCoordinateIterable.DataCoordinateSequence¶
- Transform this iterable into a - DataCoordinateSequence.- Returns: - seq : DataCoordinateSequence
- A new - DatasetCoordinateSequencewith the same elements as- self, in the same order. May be- selfif it is already a- DataCoordinateSequence.
 
- seq : 
 - 
toSet() → lsst.daf.butler.core.dimensions._dataCoordinateIterable.DataCoordinateSet¶
- Transform this iterable into a - DataCoordinateSet.- Returns: - set : DataCoordinateSet
- A - DatasetCoordinateSetinstance with the same elements as- self, after removing any duplicates. May be- selfif it is already a- DataCoordinateSet.
 
- set : 
 - 
union(other: lsst.daf.butler.core.dimensions._dataCoordinateIterable.DataCoordinateIterable) → lsst.daf.butler.core.dimensions._dataCoordinateIterable.DataCoordinateSet¶
- Return a new set that contains all data IDs in either - selfor- other.- Parameters: - other : DataCoordinateIterable
- An iterable of data IDs with - other.graph == self.graph.
 - Returns: - intersection : DataCoordinateSet
- A new - DataCoordinateSetinstance.
 
- other : 
 
- dataIds :