DataCoordinateSequence¶
- class lsst.daf.butler.DataCoordinateSequence(dataIds: Sequence[DataCoordinate], graph: DimensionGraph, *, hasFull: bool | None = None, hasRecords: bool | None = None, check: bool = True)¶
Bases:
_DataCoordinateCollectionBase,Sequence[DataCoordinate]Iterable supporting the full Sequence interface.
A
DataCoordinateIterableimplementation that supports the fullcollections.abc.Sequenceinterface.- Parameters:
- dataIds
collections.abc.Sequence[DataCoordinate] A sequence of
DataCoordinateinstances, with dimensions equal tograph.- graph
DimensionGraph Dimensions identified by all data IDs in the set.
- hasFull
bool, optional If
True, the caller guarantees thatDataCoordinate.hasFullreturnsTruefor all given data IDs. IfFalse, no such guarantee is made, andDataCoordinateSet.hasFullwill always returnFalse. IfNone(default),DataCoordinateSet.hasFullwill be computed from the given data IDs, immediately ifcheckisTrue, or on first use ifcheckisFalse.- hasRecords
bool, optional If
True, the caller guarantees thatDataCoordinate.hasRecordsreturnsTruefor all given data IDs. IfFalse, no such guarantee is made andDataCoordinateSet.hasRecordswill always returnFalse. IfNone(default),DataCoordinateSet.hasRecordswill be computed from the given data IDs, immediately ifcheckisTrue, or on first use ifcheckisFalse.- check: `bool`, optional
If
True(default) check that all data IDs are consistent with the givengraphand state flags at construction. IfFalse, no checking will occur.
- dataIds
Attributes Summary
Dimensions identified by these data IDs (
DimensionGraph).Universe that defines all known compatible dimensions.
Methods Summary
constrain(query, columns)Constrain a SQL query to include or relate to only known data IDs.
count(value)fromScalar(dataId)Return a
DataCoordinateIterablecontaining the single data ID.hasFull()Indicate if all data IDs in this iterable identify all dimensions.
Return whether all data IDs in this iterable contain records.
index(value, [start, [stop]])Raises ValueError if the value is not present.
subset(graph)Return a sequence whose data IDs identify a subset.
Transform this iterable into a
DataCoordinateSequence.toSet()Transform this iterable into a
DataCoordinateSet.Attributes Documentation
- graph¶
- universe¶
Universe that defines all known compatible dimensions.
Methods Documentation
- constrain(query: SimpleQuery, columns: Callable[[str], ColumnElement]) None¶
Constrain a SQL query to include or relate to only known data IDs.
- 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
- count(value) integer -- return number of occurrences of value¶
- static fromScalar(dataId: DataCoordinate) _ScalarDataCoordinateIterable¶
Return a
DataCoordinateIterablecontaining the single data ID.- Parameters:
- dataId
DataCoordinate Data ID to adapt. Must be a true
DataCoordinateinstance, not an arbitrary mapping. No runtime checking is performed.
- dataId
- Returns:
- iterable
DataCoordinateIterable A
DataCoordinateIterableinstance of unspecified (i.e. implementation-detail) subclass. Guaranteed to implement thecollections.abc.Sized(i.e.__len__) andcollections.abc.Container(i.e.__contains__) interfaces as well as that ofDataCoordinateIterable.
- iterable
- hasFull() bool¶
Indicate if all data IDs in this iterable identify all dimensions.
Not just required dimensions.
- index(value[, start[, stop]]) integer -- return first index of value.¶
Raises ValueError if the value is not present.
Supporting start and stop arguments is optional, but recommended.
- subset(graph: DimensionGraph) DataCoordinateSequence¶
Return a sequence whose data IDs identify a subset.
- Parameters:
- graph
DimensionGraph Dimensions to be identified by the data IDs in the returned iterable. Must be a subset of
self.graph.
- graph
- Returns:
- set
DataCoordinateSequence A
DataCoordinateSequencewithset.graph == graph. Will beselfifgraph == self.graph. Elements are equivalent to those that would be created by callingDataCoordinate.subseton all elements inself, in the same order and with no deduplication.
- set
- toSequence() DataCoordinateSequence¶
Transform this iterable into a
DataCoordinateSequence.- Returns:
- seq
DataCoordinateSequence A new
DatasetCoordinateSequencewith the same elements asself, in the same order. May beselfif it is already aDataCoordinateSequence.
- seq
- toSet() DataCoordinateSet¶
Transform this iterable into a
DataCoordinateSet.- Returns:
- set
DataCoordinateSet A
DatasetCoordinateSetinstance with the same elements asself, after removing any duplicates. May beselfif it is already aDataCoordinateSet.
- set