lsst.daf.butler

Using the Butler

This module provides an abstracted data access interface, known as the Butler. It can be used to read and write data without having to know the details of file formats or locations.

Concrete Storage Classes

Design and Development

lsst.daf.butler is developed at https://github.com/lsst/daf_butler. You can find Jira issues for this module under the daf_butler component.

Python API reference

lsst.daf.butler Package

Functions

addDimensionForeignKey(tableSpec, dimension, …) Add a field and possibly a foreign key to a table specification.
is_timespan_column(tag) Test whether a column tag is a timespan.

Classes

AbstractDatastoreCacheManager(config, …) An abstract base class for managing caching in a Datastore.
AmbiguousDatasetError Raised when a DatasetRef is not resolved but should be.
Butler(config, str, None] = None, *, butler, …) Main entry point for the data access system.
ButlerConfig(other, …) Contains the configuration for a Butler
ButlerLogRecords Class representing a collection of ButlerLogRecord.
ButlerRepoIndex Index of all known butler repositories.
ButlerValidationError There is a problem with the Butler configuration.
CollectionSearch An ordered search path of collections.
CollectionType Enumeration used to label different types of collections.
ColumnCategorization(dimension_keys, …)
ColumnTypeInfo(timespan_cls, universe, …) A struct that aggregates information about column types that can differ across data repositories due to Registry and dimension configuration.
CompositesConfig([other, validate, …]) Configuration specifics for Composites.
CompositesMap(config, ButlerConfig, …) Determine whether something should be disassembled.
Config([other]) Implements a datatype that is used by Butler for configuration.
ConfigSubset([other, validate, …]) Config representing a subset of a more general configuration.
Constraints(config, str]], *, universe) Determine whether an entity is allowed to be handled.
ConstraintsConfig([other]) Configuration information for Constraints.
ConstraintsValidationError Thrown when a constraints list has mutually exclusive definitions.
DataCoordinate Data ID dictionary.
DataCoordinateIterable An abstract base class for homogeneous iterables of data IDs.
DataCoordinateSequence(dataIds, graph, *, …) Iterable supporting the full Sequence interface.
DataCoordinateSet(dataIds, graph, *, …) Iterable iteration that is set-like.
DatabaseDimension(name, storage, *, …) A Dimension class that maps directly to a database table or query.
DatabaseDimensionCombination(name, storage, …) A combination class that maps directly to a database table or query.
DatabaseDimensionElement(name, storage, *, …) An intermediate base class for DimensionElement database classes.
DatabaseTopologicalFamily(name, space, *, …) Database topological family implementation.
DatasetAssociation(ref, collection, …) Class representing the membership of a dataset in a single collection.
DatasetColumnTag(dataset_type, column) An identifier for Relation columns that represent columns from a dataset query or subquery.
DatasetComponent(name, storageClass, component) Component of a dataset and associated information.
DatasetIdFactory Factory for dataset IDs (UUIDs).
DatasetIdGenEnum This enum is used to specify dataset ID generation options for insert() method.
DatasetRef(datasetType, dataId, *, id, …) Reference to a Dataset in a Registry.
DatasetRefURIs(primaryURI, componentURIs, …) Represents the primary and component ResourcePath(s) associated with a DatasetRef.
DatasetType(name, dimensions, …) A named category of Datasets.
DatasetTypeNotSupportedError A DatasetType is not handled by this routine.
Datastore(config, str], bridgeManager, …) Datastore interface.
DatastoreCacheManager(config, …) A class for managing caching in a Datastore using local files.
DatastoreCacheManagerConfig([other, …]) Configuration information for DatastoreCacheManager.
DatastoreConfig([other, validate, …]) Configuration for Datastores.
DatastoreDisabledCacheManager(config, …) A variant of the datastore cache where no cache is enabled.
DatastoreRecordData(records, uuid.UUID], …) A struct that represents a tabular data export from a single datastore.
DatastoreValidationError There is a problem with the Datastore configuration.
DeferredDatasetHandle(butler, ref, …) Proxy class that provides deferred loading of datasets from a butler.
Dimension A dimension.
DimensionCombination Element with extra information.
DimensionConfig(other, …) Configuration that defines a DimensionUniverse.
DimensionElement A label and/or metadata in the dimensions system.
DimensionGraph An immutable, dependency-complete collection of dimensions.
DimensionKeyColumnTag(dimension) An identifier for Relation columns that represent a dimension primary key value.
DimensionPacker(fixed, dimensions) Class for going from DataCoordinate to packed integer ID and back.
DimensionRecord(**kwargs) Base class for the Python representation of database records.
DimensionRecordColumnTag(element, column) An identifier for Relation columns that represent non-key columns in a dimension or dimension element record.
DimensionRecordsAccumulator() Class used to accumulate dimension records for serialization.
DimensionUniverse Self-consistent set of dimensions.
FileDataset(path, urllib.parse.ParseResult, …) A struct that represents a dataset exported to a file.
FileDescriptor(location, storageClass, …) Describes a particular file.
FileTemplate(template) Format a path template into a fully expanded path.
FileTemplateValidationError Exception for file template inconsistent with associated DatasetType.
FileTemplates(config, str], default, *, universe) Collection of FileTemplate templates.
FileTemplatesConfig([other]) Configuration information for FileTemplates.
Formatter(fileDescriptor, dataId, …) Interface for reading and writing Datasets.
FormatterFactory() Factory for Formatter instances.
GovernorDimension(name, storage, *, …) Governor dimension.
LimitedButler A minimal butler interface that is sufficient to back PipelineTask execution.
Location(datastoreRootUri, str, …) Identifies a location within the Datastore.
LocationFactory(datastoreRoot, …) Factory for Location instances.
LookupKey(name, dimensions, …) Representation of key that can be used to lookup information.
MappingFactory(refType) Register the mapping of some key to a python type and retrieve instances.
NameMappingSetView(mapping, K_co]) A lightweight implementation of NamedValueAbstractSet.
NamedKeyDict(*args) Dictionary wrapper for named keys.
NamedKeyMapping Custom mapping class.
NamedValueAbstractSet Custom sets with named elements.
NamedValueMutableSet Mutable variant of NamedValueAbstractSet.
NamedValueSet(elements) Custom mutable set class.
Progress(name, level) Public interface for reporting incremental progress in the butler and related tools.
PruneCollectionsArgsError Base class for errors relating to Butler.pruneCollections input arguments.
PurgeUnsupportedPruneCollectionsError(…) Raised when purge is True but is not supported for the given collection.
PurgeWithoutUnstorePruneCollectionsError() Raised when purge and unstore are both required to be True, and purge is True but unstore is False.
Quantum(*, taskName, None] = None, …) Class representing a discrete unit of work.
QuantumBackedButler(predicted_inputs, …) An implementation of LimitedButler intended to back execution of a single Quantum.
QuantumProvenanceData A serializable struct for per-quantum provenance information and datastore records.
Registry Abstract Registry interface.
RegistryConfig([other, validate, …])
RunWithoutPurgePruneCollectionsError(…) Raised when pruning a RUN collection but purge is False.
SerializedDataCoordinate Simplified model for serializing a DataCoordinate.
SerializedDatasetRef Simplified model of a DatasetRef suitable for serialization.
SerializedDatasetType Simplified model of a DatasetType suitable for serialization.
SerializedDatastoreRecordData Representation of a DatastoreRecordData suitable for serialization.
SerializedDimensionGraph Simplified model of a DimensionGraph suitable for serialization.
SerializedDimensionRecord Simplified model for serializing a DimensionRecord.
SerializedQuantum Simplified model of a Quantum suitable for serialization.
SkyPixDimension(system, level) Special dimension for sky pixelizations.
SkyPixSystem(name, *, maxLevel, …) Class for hierarchical pixelization of the sky.
StorageClass(name, None] = None, pytype, …) Class describing how a label maps to a particular Python type.
StorageClassConfig([other, validate, …]) Configuration class for defining Storage Classes.
StorageClassDelegate(storageClass) Delegate class for StorageClass components and parameters.
StorageClassFactory(config, str, None] = None) Factory for StorageClass instances.
StoredDatastoreItemInfo Internal information associated with a stored dataset in a Datastore.
StoredFileInfo(formatter, path, …) Datastore-private metadata associated with a Datastore file.
Timespan(begin, …) A half-open time interval with nanosecond precision.
TimespanDatabaseRepresentation An interface for representing a timespan in a database.
TopologicalFamily(name, space) A grouping of TopologicalRelationshipEndpoint objects.
TopologicalRelationshipEndpoint Representation of a logical table that can participate in overlap joins.
TopologicalSpace Enumeration of continuous-variable relationships for dimensions.
ValidationError Some sort of validation error has occurred.
YamlRepoExportBackend(stream, universe) A repository export implementation that saves to a YAML file.
YamlRepoImportBackend(stream, registry) A repository import implementation that reads from a YAML file.

Class Inheritance Diagram

Inheritance diagram of lsst.daf.butler.core.datastoreCacheManager.AbstractDatastoreCacheManager, lsst.daf.butler.core.datasets.ref.AmbiguousDatasetError, lsst.daf.butler._butler.Butler, lsst.daf.butler._butlerConfig.ButlerConfig, lsst.daf.butler.core.logging.ButlerLogRecords, lsst.daf.butler._butlerRepoIndex.ButlerRepoIndex, lsst.daf.butler._butler.ButlerValidationError, lsst.daf.butler.registry.wildcards.CollectionSearch, lsst.daf.butler.registry._collectionType.CollectionType, lsst.daf.butler.core._column_categorization.ColumnCategorization, lsst.daf.butler.core._column_type_info.ColumnTypeInfo, lsst.daf.butler.core.composites.CompositesConfig, lsst.daf.butler.core.composites.CompositesMap, lsst.daf.butler.core.config.Config, lsst.daf.butler.core.config.ConfigSubset, lsst.daf.butler.core.constraints.Constraints, lsst.daf.butler.core.constraints.ConstraintsConfig, lsst.daf.butler.core.constraints.ConstraintsValidationError, lsst.daf.butler.core.dimensions._coordinate.DataCoordinate, lsst.daf.butler.core.dimensions._dataCoordinateIterable.DataCoordinateIterable, lsst.daf.butler.core.dimensions._dataCoordinateIterable.DataCoordinateSequence, lsst.daf.butler.core.dimensions._dataCoordinateIterable.DataCoordinateSet, lsst.daf.butler.core.dimensions._database.DatabaseDimension, lsst.daf.butler.core.dimensions._database.DatabaseDimensionCombination, lsst.daf.butler.core.dimensions._database.DatabaseDimensionElement, lsst.daf.butler.core.dimensions._database.DatabaseTopologicalFamily, lsst.daf.butler.core.datasets.association.DatasetAssociation, lsst.daf.butler.core._column_tags.DatasetColumnTag, lsst.daf.butler.core.storageClassDelegate.DatasetComponent, lsst.daf.butler.registry.interfaces._datasets.DatasetIdFactory, lsst.daf.butler.registry.interfaces._datasets.DatasetIdGenEnum, lsst.daf.butler.core.datasets.ref.DatasetRef, lsst.daf.butler.core.datastore.DatasetRefURIs, lsst.daf.butler.core.datasets.type.DatasetType, lsst.daf.butler.core.exceptions.DatasetTypeNotSupportedError, lsst.daf.butler.core.datastore.Datastore, lsst.daf.butler.core.datastoreCacheManager.DatastoreCacheManager, lsst.daf.butler.core.datastoreCacheManager.DatastoreCacheManagerConfig, lsst.daf.butler.core.datastore.DatastoreConfig, lsst.daf.butler.core.datastoreCacheManager.DatastoreDisabledCacheManager, lsst.daf.butler.core.datastoreRecordData.DatastoreRecordData, lsst.daf.butler.core.datastore.DatastoreValidationError, lsst.daf.butler._deferredDatasetHandle.DeferredDatasetHandle, lsst.daf.butler.core.dimensions._elements.Dimension, lsst.daf.butler.core.dimensions._elements.DimensionCombination, lsst.daf.butler.core.dimensions._config.DimensionConfig, lsst.daf.butler.core.dimensions._elements.DimensionElement, lsst.daf.butler.core.dimensions._graph.DimensionGraph, lsst.daf.butler.core._column_tags.DimensionKeyColumnTag, lsst.daf.butler.core.dimensions._packer.DimensionPacker, lsst.daf.butler.core.dimensions._records.DimensionRecord, lsst.daf.butler.core._column_tags.DimensionRecordColumnTag, lsst.daf.butler.core.quantum.DimensionRecordsAccumulator, lsst.daf.butler.core.dimensions._universe.DimensionUniverse, lsst.daf.butler.core.fileDataset.FileDataset, lsst.daf.butler.core.fileDescriptor.FileDescriptor, lsst.daf.butler.core.fileTemplates.FileTemplate, lsst.daf.butler.core.fileTemplates.FileTemplateValidationError, lsst.daf.butler.core.fileTemplates.FileTemplates, lsst.daf.butler.core.fileTemplates.FileTemplatesConfig, lsst.daf.butler.core.formatter.Formatter, lsst.daf.butler.core.formatter.FormatterFactory, lsst.daf.butler.core.dimensions._governor.GovernorDimension, lsst.daf.butler._limited_butler.LimitedButler, lsst.daf.butler.core.location.Location, lsst.daf.butler.core.location.LocationFactory, lsst.daf.butler.core.configSupport.LookupKey, lsst.daf.butler.core.mappingFactory.MappingFactory, lsst.daf.butler.core.named.NameMappingSetView, lsst.daf.butler.core.named.NamedKeyDict, lsst.daf.butler.core.named.NamedKeyMapping, lsst.daf.butler.core.named.NamedValueAbstractSet, lsst.daf.butler.core.named.NamedValueMutableSet, lsst.daf.butler.core.named.NamedValueSet, lsst.daf.butler.core.progress.Progress, lsst.daf.butler._butler.PruneCollectionsArgsError, lsst.daf.butler._butler.PurgeUnsupportedPruneCollectionsError, lsst.daf.butler._butler.PurgeWithoutUnstorePruneCollectionsError, lsst.daf.butler.core.quantum.Quantum, lsst.daf.butler._quantum_backed.QuantumBackedButler, lsst.daf.butler._quantum_backed.QuantumProvenanceData, lsst.daf.butler.registry._registry.Registry, lsst.daf.butler.registry._config.RegistryConfig, lsst.daf.butler._butler.RunWithoutPurgePruneCollectionsError, lsst.daf.butler.core.dimensions._coordinate.SerializedDataCoordinate, lsst.daf.butler.core.datasets.ref.SerializedDatasetRef, lsst.daf.butler.core.datasets.type.SerializedDatasetType, lsst.daf.butler.core.datastoreRecordData.SerializedDatastoreRecordData, lsst.daf.butler.core.dimensions._graph.SerializedDimensionGraph, lsst.daf.butler.core.dimensions._records.SerializedDimensionRecord, lsst.daf.butler.core.quantum.SerializedQuantum, lsst.daf.butler.core.dimensions._skypix.SkyPixDimension, lsst.daf.butler.core.dimensions._skypix.SkyPixSystem, lsst.daf.butler.core.storageClass.StorageClass, lsst.daf.butler.core.storageClass.StorageClassConfig, lsst.daf.butler.core.storageClassDelegate.StorageClassDelegate, lsst.daf.butler.core.storageClass.StorageClassFactory, lsst.daf.butler.core.storedFileInfo.StoredDatastoreItemInfo, lsst.daf.butler.core.storedFileInfo.StoredFileInfo, lsst.daf.butler.core.timespan.Timespan, lsst.daf.butler.core.timespan.TimespanDatabaseRepresentation, lsst.daf.butler.core._topology.TopologicalFamily, lsst.daf.butler.core._topology.TopologicalRelationshipEndpoint, lsst.daf.butler.core._topology.TopologicalSpace, lsst.daf.butler.core.exceptions.ValidationError, lsst.daf.butler.transfers._yaml.YamlRepoExportBackend, lsst.daf.butler.transfers._yaml.YamlRepoImportBackend

class lsst.daf.butler.ButlerURI(uri)

ButlerURI implementation. Exists for backwards compatibility. New code should use lsst.resources.ResourcePath.

lsst.daf.butler.registry Package

Classes

ArgumentError Exception raised when method arguments are invalid or inconsistent.
CollectionError Exception raised for collection-related errors.
CollectionExpressionError Exception raised for an incorrect collection expression.
CollectionSearch An ordered search path of collections.
CollectionSummary(dataset_types, governors) A summary of the datasets that can be found in a collection.
CollectionType Enumeration used to label different types of collections.
CollectionTypeError Exception raised when type of a collection is incorrect.
ConflictingDefinitionError Exception raised when trying to insert a database record when a conflicting record already exists.
DataIdError Exception raised for incorrect data IDs, this is a base class for other specific error types.
DataIdValueError Exception raised when a value specified in a data ID does not exist.
DatasetIdFactory Factory for dataset IDs (UUIDs).
DatasetIdGenEnum This enum is used to specify dataset ID generation options for insert() method.
DatasetTypeError Exception raised for problems with dataset types.
DatasetTypeExpressionError Exception raised for an incorrect dataset type expression.
DbAuth(path, None] = None, envVar, …) Retrieves authentication information for database connections.
DbAuthError Exception raised when a problem has occurred retrieving database authentication information.
DbAuthPermissionsError Credentials file has incorrect permissions.
DimensionNameError Exception raised when a dimension specified in a data ID does not exist or required dimension is not provided.
InconsistentDataIdError Exception raised when a data ID contains contradictory key-value pairs, according to dimension relationships.
MissingCollectionError Exception raised when an operation attempts to use a collection that does not exist.
MissingDatasetTypeError Exception raised when a dataset type does not exist.
MissingSpatialOverlapError Exception raised when a spatial overlap relationship needed by a query has not been precomputed and cannot be computed on-the-fly.
NoDefaultCollectionError Exception raised when a collection is needed, but collection argument is not provided and default collection is not defined in registry.
OrphanedRecordError Exception raised when trying to remove or modify a database record that is still being used in some other table.
Registry Abstract Registry interface.
RegistryConfig([other, validate, …])
RegistryDefaults(collections, None] = None, …) A struct used to provide the default collections searched or written to by a Registry or Butler instance.
RegistryError Base class for many exception classes produced by Registry methods.
UnsupportedIdGeneratorError Exception raised when an unsupported DatasetIdGenEnum option is used for insert/import.
UserExpressionError Exception raised for problems with user expression.
UserExpressionSyntaxError Exception raised when a user query expression cannot be parsed.

Class Inheritance Diagram

Inheritance diagram of lsst.daf.butler.registry._exceptions.ArgumentError, lsst.daf.butler.registry._exceptions.CollectionError, lsst.daf.butler.registry._exceptions.CollectionExpressionError, lsst.daf.butler.registry.wildcards.CollectionSearch, lsst.daf.butler.registry._collection_summary.CollectionSummary, lsst.daf.butler.registry._collectionType.CollectionType, lsst.daf.butler.registry._exceptions.CollectionTypeError, lsst.daf.butler.registry._exceptions.ConflictingDefinitionError, lsst.daf.butler.registry._exceptions.DataIdError, lsst.daf.butler.registry._exceptions.DataIdValueError, lsst.daf.butler.registry.interfaces._datasets.DatasetIdFactory, lsst.daf.butler.registry.interfaces._datasets.DatasetIdGenEnum, lsst.daf.butler.registry._exceptions.DatasetTypeError, lsst.daf.butler.registry._exceptions.DatasetTypeExpressionError, lsst.daf.butler.registry._dbAuth.DbAuth, lsst.daf.butler.registry._dbAuth.DbAuthError, lsst.daf.butler.registry._dbAuth.DbAuthPermissionsError, lsst.daf.butler.registry._exceptions.DimensionNameError, lsst.daf.butler.registry._exceptions.InconsistentDataIdError, lsst.daf.butler.registry._exceptions.MissingCollectionError, lsst.daf.butler.registry._exceptions.MissingDatasetTypeError, lsst.daf.butler.registry._exceptions.MissingSpatialOverlapError, lsst.daf.butler.registry._exceptions.NoDefaultCollectionError, lsst.daf.butler.registry._exceptions.OrphanedRecordError, lsst.daf.butler.registry._registry.Registry, lsst.daf.butler.registry._config.RegistryConfig, lsst.daf.butler.registry._defaults.RegistryDefaults, lsst.daf.butler.registry._exceptions.RegistryError, lsst.daf.butler.registry._exceptions.UnsupportedIdGeneratorError, lsst.daf.butler.registry._exceptions.UserExpressionError, lsst.daf.butler.registry._exceptions.UserExpressionSyntaxError

lsst.daf.butler.registry.interfaces Package

Classes

ButlerAttributeExistsError Exception raised when trying to update existing attribute without specifying force option.
ButlerAttributeManager An interface for managing butler attributes in a Registry.
ChainedCollectionRecord(key, name, universe) A subclass of CollectionRecord that adds the list of child collections in a CHAINED collection.
CollectionManager() An interface for managing the collections (including runs) in a Registry.
CollectionRecord(key, name, type) A struct used to represent a collection in internal Registry APIs.
Database(*, origin, engine, namespace, …) An abstract interface that represents a particular database engine’s representation of a single schema/namespace/database.
DatabaseConflictError Exception raised when database content (row values or schema entities) are inconsistent with what this client expects.
DatabaseDimensionOverlapStorage A base class for objects that manage overlaps between a pair of database-backed dimensions.
DatabaseDimensionRecordStorage Intermediate interface for DimensionRecordStorage objects that provide storage for DatabaseDimensionElement instances.
DatasetIdFactory Factory for dataset IDs (UUIDs).
DatasetIdGenEnum This enum is used to specify dataset ID generation options for insert() method.
DatasetRecordStorage(datasetType) An interface that manages the records associated with a particular DatasetType.
DatasetRecordStorageManager An interface that manages the tables that describe datasets.
DatastoreRegistryBridge(datastoreName) An abstract base class that defines the interface that a Datastore uses to communicate with a Registry.
DatastoreRegistryBridgeManager(*, opaque, …) An abstract base class that defines the interface between Registry and Datastore when a new Datastore is constructed.
DimensionRecordStorage An abstract base class that represents a way of storing the records associated with a single DimensionElement.
DimensionRecordStorageManager(*, universe) An interface for managing the dimension records in a Registry.
FakeDatasetRef(id, uuid.UUID]) A fake DatasetRef that can be used internally by butler where only the dataset ID is available.
GovernorDimensionRecordStorage Intermediate interface for DimensionRecordStorage objects that provide storage for GovernorDimension instances.
ObsCoreTableManager An interface for populating ObsCore tables(s).
OpaqueTableStorage(name) An interface that manages the records associated with a particular opaque table in a Registry.
OpaqueTableStorageManager An interface that manages the opaque tables in a Registry.
ReadOnlyDatabaseError Exception raised when a write operation is called on a read-only Database.
RunRecord(key, name, type) A subclass of CollectionRecord that adds execution information and an interface for updating it.
SchemaAlreadyDefinedError Exception raised when trying to initialize database schema when some tables already exist.
SkyPixDimensionRecordStorage Intermediate interface for DimensionRecordStorage objects that provide storage for SkyPixDimension instances.
StaticTablesContext(db, connection) Helper class used to declare the static schema for a registry layer in a database.
VersionTuple Class representing a version number.
VersionedExtension Interface for extension classes with versions.

Class Inheritance Diagram

Inheritance diagram of lsst.daf.butler.registry.interfaces._attributes.ButlerAttributeExistsError, lsst.daf.butler.registry.interfaces._attributes.ButlerAttributeManager, lsst.daf.butler.registry.interfaces._collections.ChainedCollectionRecord, lsst.daf.butler.registry.interfaces._collections.CollectionManager, lsst.daf.butler.registry.interfaces._collections.CollectionRecord, lsst.daf.butler.registry.interfaces._database.Database, lsst.daf.butler.registry.interfaces._database.DatabaseConflictError, lsst.daf.butler.registry.interfaces._dimensions.DatabaseDimensionOverlapStorage, lsst.daf.butler.registry.interfaces._dimensions.DatabaseDimensionRecordStorage, lsst.daf.butler.registry.interfaces._datasets.DatasetIdFactory, lsst.daf.butler.registry.interfaces._datasets.DatasetIdGenEnum, lsst.daf.butler.registry.interfaces._datasets.DatasetRecordStorage, lsst.daf.butler.registry.interfaces._datasets.DatasetRecordStorageManager, lsst.daf.butler.registry.interfaces._bridge.DatastoreRegistryBridge, lsst.daf.butler.registry.interfaces._bridge.DatastoreRegistryBridgeManager, lsst.daf.butler.registry.interfaces._dimensions.DimensionRecordStorage, lsst.daf.butler.registry.interfaces._dimensions.DimensionRecordStorageManager, lsst.daf.butler.registry.interfaces._bridge.FakeDatasetRef, lsst.daf.butler.registry.interfaces._dimensions.GovernorDimensionRecordStorage, lsst.daf.butler.registry.interfaces._obscore.ObsCoreTableManager, lsst.daf.butler.registry.interfaces._opaque.OpaqueTableStorage, lsst.daf.butler.registry.interfaces._opaque.OpaqueTableStorageManager, lsst.daf.butler.registry.interfaces._database.ReadOnlyDatabaseError, lsst.daf.butler.registry.interfaces._collections.RunRecord, lsst.daf.butler.registry.interfaces._database.SchemaAlreadyDefinedError, lsst.daf.butler.registry.interfaces._dimensions.SkyPixDimensionRecordStorage, lsst.daf.butler.registry.interfaces._database.StaticTablesContext, lsst.daf.butler.registry.interfaces._versioning.VersionTuple, lsst.daf.butler.registry.interfaces._versioning.VersionedExtension

lsst.daf.butler.registry.queries Package

Classes

ChainedDatasetQueryResults(chain, doomed_by) A DatasetQueryResults implementation that simply chains together other results objects, each for a different parent dataset type.
DataCoordinateQueryResults(query) An enhanced implementation of DataCoordinateIterable that represents data IDs retrieved from a database query.
DataCoordinateReader Base class and factory for reader objects that extract DataCoordinate instances from query result rows.
DatabaseDimensionRecordQueryResults(query, …) Implementation of DimensionRecordQueryResults using database query.
DatasetQueryResults An interface for objects that represent the results of queries for datasets.
DatasetRefReader(dataset_type, *, full, …) Reader class that extracts DatasetRef objects from query result rows.
DimensionRecordQueryResults An interface for objects that represent the results of queries for dimension records.
DimensionRecordReader(element)
ParentDatasetQueryResults(query, …) An object that represents results from a query for datasets with a single parent DatasetType.
QueryBackend An interface for constructing and evaluating the Relation objects that comprise registry queries.
QueryBuilder(summary, backend, context, …) A builder for potentially complex queries that join tables based on dimension relationships.
QueryContext() A context manager interface for query operations that require some connection-like state.
QuerySummary(requested, *, data_id, …) A struct that holds and categorizes the dimensions involved in a query.
SqlQueryBackend(db, managers) An implementation of QueryBackend for SqlRegistry.
SqlQueryContext(db, column_types, row_chunk_size) An implementation of sql.QueryContext for SqlRegistry.

Class Inheritance Diagram

Inheritance diagram of lsst.daf.butler.registry.queries._results.ChainedDatasetQueryResults, lsst.daf.butler.registry.queries._results.DataCoordinateQueryResults, lsst.daf.butler.registry.queries._readers.DataCoordinateReader, lsst.daf.butler.registry.queries._results.DatabaseDimensionRecordQueryResults, lsst.daf.butler.registry.queries._results.DatasetQueryResults, lsst.daf.butler.registry.queries._readers.DatasetRefReader, lsst.daf.butler.registry.queries._results.DimensionRecordQueryResults, lsst.daf.butler.registry.queries._readers.DimensionRecordReader, lsst.daf.butler.registry.queries._results.ParentDatasetQueryResults, lsst.daf.butler.registry.queries._query_backend.QueryBackend, lsst.daf.butler.registry.queries._builder.QueryBuilder, lsst.daf.butler.registry.queries._query_context.QueryContext, lsst.daf.butler.registry.queries._structs.QuerySummary, lsst.daf.butler.registry.queries._sql_query_backend.SqlQueryBackend, lsst.daf.butler.registry.queries._sql_query_context.SqlQueryContext

lsst.daf.butler.registry.wildcards Module

Classes

CategorizedWildcard(strings, patterns, items) The results of preprocessing a wildcard expression to separate match patterns from strings.
CollectionWildcard(strings, patterns, …) A validated wildcard for collection names
CollectionSearch An ordered search path of collections.
DatasetTypeWildcard(values, …) A validated expression that resolves to one or more dataset types.

Class Inheritance Diagram

Inheritance diagram of lsst.daf.butler.registry.wildcards.CategorizedWildcard, lsst.daf.butler.registry.wildcards.CollectionWildcard, lsst.daf.butler.registry.wildcards.CollectionSearch, lsst.daf.butler.registry.wildcards.DatasetTypeWildcard

Example datastores

lsst.daf.butler.datastores.chainedDatastore Module

Classes
ChainedDatastore(config, str], …) Chained Datastores to allow read and writes from multiple datastores.
Class Inheritance Diagram

Inheritance diagram of lsst.daf.butler.datastores.chainedDatastore.ChainedDatastore

lsst.daf.butler.datastores.inMemoryDatastore Module

Classes
StoredMemoryItemInfo(timestamp, …) Internal InMemoryDatastore Metadata associated with a stored DatasetRef.
InMemoryDatastore(config, str], …) Basic Datastore for writing to an in memory cache.
Class Inheritance Diagram

Inheritance diagram of lsst.daf.butler.datastores.inMemoryDatastore.StoredMemoryItemInfo, lsst.daf.butler.datastores.inMemoryDatastore.InMemoryDatastore

lsst.daf.butler.datastores.fileDatastore Module

Classes
FileDatastore(config, str], bridgeManager, …) Generic Datastore for file-based implementations.
Class Inheritance Diagram

Inheritance diagram of lsst.daf.butler.datastores.fileDatastore.FileDatastore

Example formatters

lsst.daf.butler.formatters.file Module

Classes
FileFormatter(fileDescriptor, dataId, …) Interface for reading and writing files on a POSIX file system.
Class Inheritance Diagram

Inheritance diagram of lsst.daf.butler.formatters.file.FileFormatter

lsst.daf.butler.formatters.json Module

Classes
JsonFormatter(fileDescriptor, dataId, …) Formatter implementation for JSON files.
Class Inheritance Diagram

Inheritance diagram of lsst.daf.butler.formatters.json.JsonFormatter

lsst.daf.butler.formatters.matplotlib Module

Classes
MatplotlibFormatter(fileDescriptor, dataId, …) Interface for writing matplotlib figures.
Class Inheritance Diagram

Inheritance diagram of lsst.daf.butler.formatters.matplotlib.MatplotlibFormatter

lsst.daf.butler.formatters.parquet Module

Functions
arrow_to_pandas(arrow_table) Convert a pyarrow table to a pandas DataFrame.
arrow_to_astropy(arrow_table) Convert a pyarrow table to an astropy.Table.
arrow_to_numpy(arrow_table) Convert a pyarrow table to a structured numpy array.
arrow_to_numpy_dict(arrow_table) Convert a pyarrow table to a dict of numpy arrays.
pandas_to_arrow(dataframe, default_length) Convert a pandas dataframe to an arrow table.
pandas_to_astropy(dataframe) Convert a pandas dataframe to an astropy table, preserving indexes.
astropy_to_arrow(astropy_table) Convert an astropy table to an arrow table.
numpy_to_arrow(np_array) Convert a numpy array table to an arrow table.
numpy_to_astropy(np_array) Convert a numpy table to an astropy table.
numpy_dict_to_arrow(numpy_dict, np.ndarray]) Convert a dict of numpy arrays to an arrow table.
arrow_schema_to_pandas_index(schema) Convert an arrow schema to a pandas index/multiindex.
Classes
ParquetFormatter(fileDescriptor, dataId, …) Interface for reading and writing Arrow Table objects to and from Parquet files.
DataFrameSchema(dataframe) Wrapper class for a schema for a pandas DataFrame.
ArrowAstropySchema(astropy_table) Wrapper class for a schema for an astropy table.
ArrowNumpySchema(numpy_dtype) Wrapper class for a schema for a numpy ndarray.
Class Inheritance Diagram

Inheritance diagram of lsst.daf.butler.formatters.parquet.ParquetFormatter, lsst.daf.butler.formatters.parquet.DataFrameSchema, lsst.daf.butler.formatters.parquet.ArrowAstropySchema, lsst.daf.butler.formatters.parquet.ArrowNumpySchema

lsst.daf.butler.formatters.pickle Module

Classes
PickleFormatter(fileDescriptor, dataId, …) Interface for reading and writing Python objects to and from pickle files.
Class Inheritance Diagram

Inheritance diagram of lsst.daf.butler.formatters.pickle.PickleFormatter

lsst.daf.butler.formatters.yaml Module

Classes
YamlFormatter(fileDescriptor, dataId, …) Formatter implementation for YAML files.
Class Inheritance Diagram

Inheritance diagram of lsst.daf.butler.formatters.yaml.YamlFormatter

Database backends

lsst.daf.butler.registry.databases.sqlite Module

Classes
SqliteDatabase(*, engine, origin, namespace, …) An implementation of the Database interface for SQLite3.
Class Inheritance Diagram

Inheritance diagram of lsst.daf.butler.registry.databases.sqlite.SqliteDatabase

lsst.daf.butler.registry.databases.postgresql Module

Classes
PostgresqlDatabase(*, engine, origin, …) An implementation of the Database interface for PostgreSQL.
Class Inheritance Diagram

Inheritance diagram of lsst.daf.butler.registry.databases.postgresql.PostgresqlDatabase

Support API

lsst.daf.butler.core.utils Module

Functions
stripIfNotNone(s, None]) Strip leading and trailing whitespace if the given object is not None.
transactional(func) Decorate a method and makes it transactional.

lsst.daf.butler.core.repoRelocation Module

Functions
replaceRoot(configRoot, butlerRoot, …) Update a configuration root with the butler root location.
Variables
BUTLER_ROOT_TAG The special string to be used in configuration files to indicate that the butler root location should be used.

Test utilities

lsst.daf.butler.tests Package

Functions

addDataIdValue(butler, dimension, value, …) Add the records that back a new data ID to a repository.
addDatasetType(butler, name, dimensions, …) Add a new dataset type to a repository.
expandUniqueId(butler, partialId, Any]) Return a complete data ID matching some criterion.
makeTestCollection(repo, uniqueId, None] = None) Create a read/write Butler to a fresh collection.
makeTestRepo(root, dataIds, …) Create an empty test repository.
registerMetricsExample(butler) Modify a repository to support reading and writing MetricsExample objects.

Classes

BadNoWriteFormatter(fileDescriptor, dataId, …) A formatter that always fails without writing anything.
BadWriteFormatter(fileDescriptor, dataId, …) A formatter that never works but does leave a file behind.
CliCmdTestBase A test case base that is used to verify click command functions import and call their respective script functions correctly.
CliLogTestBase Tests log initialization, reset, and setting log levels.
DatasetTestHelper Helper methods for Datasets
DatastoreMock Mocks a butler datastore.
DatastoreTestHelper Helper methods for Datastore tests
DummyRegistry() Dummy Registry, for Datastore test purposes.
ListDelegate(storageClass) Parameter handler for list parameters
MetricsDelegate(storageClass) Parameter handler for parameters using Metrics
MetricsExample(summary, None] = None, …) Smorgasboard of information that might be the result of some processing.
MetricsExampleDataclass(summary, …) A variant of MetricsExample based on a dataclass.
MetricsExampleModel A variant of MetricsExample based on model.
MultiDetectorFormatter(fileDescriptor, …)

Command Line Interface API

Warning

The command line interface API (everything in lsst.daf.butler.cli) is for only for developer use to write command line interfaces, and is not intended for general use.

lsst.daf.butler.cli.butler Module

Functions

main()

Classes

LoaderCLI(*args, **kwargs) Extends click.MultiCommand, which dispatches to subcommands, to load subcommands at runtime.
ButlerCLI(*args, **kwargs)

Class Inheritance Diagram

Inheritance diagram of lsst.daf.butler.cli.butler.LoaderCLI, lsst.daf.butler.cli.butler.ButlerCLI

lsst.daf.butler.cli.cmd Package

Variables

associate Add existing datasets to a tagged collection; searches for datasets with the options and adds them to the named COLLECTION.
butler_import Import data into a butler repository.
certify_calibrations Certify calibrations in a repository.
create Create an empty Gen3 Butler repository.
collection_chain Define a collection chain.
config_dump Dump either a subset or full Butler configuration to standard output.
config_validate Validate the configuration files for a Gen3 Butler repository.
export_calibs Export calibrations from the butler for import elsewhere.
ingest_files Ingest files from table file.
prune_collection Remove a collection and possibly prune datasets within it.
prune_datasets Query for and remove one or more datasets from a collection and/or storage.
query_collections Get the collections whose names match an expression.
query_data_ids List the data IDs in a repository.
query_dataset_types Get the dataset types in a repository.
query_datasets List the datasets in a repository.
query_dimension_records Query for dimension information.
register_dataset_type Register a new dataset type with this butler repository.
retrieve_artifacts Retrieve file artifacts associated with datasets in a repository.
remove_collections Remove one or more non-RUN collections.
remove_runs Remove one or more RUN collections.
remove_dataset_type Remove a dataset type definition from a repository.
transfer_datasets Transfer datasets from a source butler to a destination butler.

lsst.daf.butler.cli.opt Package

Classes

CollectionTypeCallback
query_datasets_options(repo, showUri, …)

Variables

collection_argument Wraps the click.argument decorator to enable shared arguments to be declared.
collection_type_option Wraps the click.option decorator to enable shared options to be declared and allows inspection of the shared option.
collections_argument Wraps the click.argument decorator to enable shared arguments to be declared.
collections_option Wraps the click.option decorator to enable shared options to be declared and allows inspection of the shared option.
components_option Wraps the click.option decorator to enable shared options to be declared and allows inspection of the shared option.
config_file_option Wraps the click.option decorator to enable shared options to be declared and allows inspection of the shared option.
config_option Wraps the click.option decorator to enable shared options to be declared and allows inspection of the shared option.
confirm_option Wraps the click.option decorator to enable shared options to be declared and allows inspection of the shared option.
dataset_type_option Wraps the click.option decorator to enable shared options to be declared and allows inspection of the shared option.
datasets_option Wraps the click.option decorator to enable shared options to be declared and allows inspection of the shared option.
destination_argument Wraps the click.argument decorator to enable shared arguments to be declared.
dimensions_argument Wraps the click.argument decorator to enable shared arguments to be declared.
directory_argument Wraps the click.argument decorator to enable shared arguments to be declared.
element_argument Wraps the click.argument decorator to enable shared arguments to be declared.
glob_argument Wraps the click.argument decorator to enable shared arguments to be declared.
limit_option Wraps the click.option decorator to enable shared options to be declared and allows inspection of the shared option.
locations_argument Wraps the click.argument decorator to enable shared arguments to be declared.
log_file_option Wraps the click.option decorator to enable shared options to be declared and allows inspection of the shared option.
log_label_option Wraps the click.option decorator to enable shared options to be declared and allows inspection of the shared option.
log_level_option Wraps the click.option decorator to enable shared options to be declared and allows inspection of the shared option.
log_tty_option Wraps the click.option decorator to enable shared options to be declared and allows inspection of the shared option.
long_log_option Wraps the click.option decorator to enable shared options to be declared and allows inspection of the shared option.
offset_option Wraps the click.option decorator to enable shared options to be declared and allows inspection of the shared option.
options_file_option Wraps the click.option decorator to enable shared options to be declared and allows inspection of the shared option.
order_by_option Wraps the click.option decorator to enable shared options to be declared and allows inspection of the shared option.
processes_option Wraps the click.option decorator to enable shared options to be declared and allows inspection of the shared option.
regex_option Wraps the click.option decorator to enable shared options to be declared and allows inspection of the shared option.
register_dataset_types_option Wraps the click.option decorator to enable shared options to be declared and allows inspection of the shared option.
repo_argument Wraps the click.argument decorator to enable shared arguments to be declared.
run_option Wraps the click.option decorator to enable shared options to be declared and allows inspection of the shared option.
transfer_dimensions_option Wraps the click.option decorator to enable shared options to be declared and allows inspection of the shared option.
transfer_option Wraps the click.option decorator to enable shared options to be declared and allows inspection of the shared option.
verbose_option Wraps the click.option decorator to enable shared options to be declared and allows inspection of the shared option.
where_option Wraps the click.option decorator to enable shared options to be declared and allows inspection of the shared option.

Class Inheritance Diagram

Inheritance diagram of lsst.daf.butler.cli.opt.options.CollectionTypeCallback, lsst.daf.butler.cli.opt.optionGroups.query_datasets_options

lsst.daf.butler.cli.utils Module

Functions

astropyTablesToStr(tables) Render astropy tables to string as they are displayed in the CLI.
printAstropyTables(tables) Print astropy tables to be displayed in the CLI.
textTypeStr(multiple) Get the text type string for CLI help documentation.
clickResultMsg(result) Get a standard assert message from a click result
command_test_env(runner, commandModule, …) A context manager that creates (and then cleans up) an environment that provides a CLI plugin command with the given name.
addArgumentHelp(doc, None], helpText) Add a Click argument’s help message to a function’s documentation.
split_commas(context, None], param, None], …) Process a tuple of values, where each value may contain comma-separated values, and return a single list of all the passed-in values.
split_kv(context, param, values, *, choice, …) Process a tuple of values that are key-value pairs separated by a given separator.
to_upper(context, param, value) Convert a value to upper case.
unwrap(val) Remove newlines and leading whitespace from a multi-line string with a consistent indentation level.
yaml_presets(ctx, param, value) Click callback that reads additional values from the supplied YAML file.
sortAstropyTable(table, dimensions, sort_first) Sort an astropy table, with prioritization given to columns in this order: 1.
catch_and_exit(func) Decorator which catches all exceptions, prints an exception traceback and signals click to exit.

Classes

LogCliRunner([charset, env, echo_stdin, …]) A test runner to use when the logging system will be initialized by code under test, calls CliLog.resetLog(), which undoes any logging setup that was done with the CliLog interface.
option_section(sectionText) Decorator to add a section label between options in the help text of a command.
MWPath(exists, None] = None, file_okay, …) Overrides click.Path to implement file-does-not-exist checking.
MWOption([param_decls, show_default, …]) Overrides click.Option with desired behaviors.
MWArgument(param_decls[, required]) Overrides click.Argument with desired behaviors.
OptionSection(sectionName, sectionText) Implements an Option that prints a section label in the help text and does not pass any value to the command function.
MWOptionDecorator(*param_decls, **kwargs) Wraps the click.option decorator to enable shared options to be declared and allows inspection of the shared option.
MWArgumentDecorator(*param_decls, **kwargs) Wraps the click.argument decorator to enable shared arguments to be declared.
MWCommand(*args, **kwargs) Command subclass that stores a copy of the args list for use by the command.
ButlerCommand(*args, **kwargs) Command subclass with butler-command specific overrides.
OptionGroup Base class for an option group decorator.
MWCtxObj() Helper object for managing the click.Context.obj parameter, allows obj data to be managed in a consistent way.

Class Inheritance Diagram

Inheritance diagram of lsst.daf.butler.cli.utils.LogCliRunner, lsst.daf.butler.cli.utils.option_section, lsst.daf.butler.cli.utils.MWPath, lsst.daf.butler.cli.utils.MWOption, lsst.daf.butler.cli.utils.MWArgument, lsst.daf.butler.cli.utils.OptionSection, lsst.daf.butler.cli.utils.MWOptionDecorator, lsst.daf.butler.cli.utils.MWArgumentDecorator, lsst.daf.butler.cli.utils.MWCommand, lsst.daf.butler.cli.utils.ButlerCommand, lsst.daf.butler.cli.utils.OptionGroup, lsst.daf.butler.cli.utils.MWCtxObj

lsst.daf.butler.cli.cliLog Module

Classes

PrecisionLogFormatter([fmt, datefmt, style, …]) A log formatter that issues accurate timezone-aware timestamps.
CliLog Interface for managing python logging and lsst.log.

Class Inheritance Diagram

Inheritance diagram of lsst.daf.butler.cli.cliLog.PrecisionLogFormatter, lsst.daf.butler.cli.cliLog.CliLog

lsst.daf.butler.cli.progress Module

Classes

ClickProgressHandler(**kwargs) A ProgressHandler implementation that delegates to click.progressbar.

Class Inheritance Diagram

Inheritance diagram of lsst.daf.butler.cli.progress.ClickProgressHandler