DataUnit

class lsst.daf.butler.DataUnit(name, requiredDependencies, optionalDependencies, link=(), table=None, spatial=False)

Bases: object

A discrete abstract unit of data that can be associated with metadata and used to label datasets.

DataUnit instances represent concrete units such as e.g. Camera, Sensor, Visit and SkyMap.

Parameters:
name : str

Name of this DataUnit. Also assumed to be the name of the primary table (if present).

requiredDependencies : frozenset

Related DataUnit instances on which existence this DataUnit instance depends.

optionalDependencies : frozenset

Related DataUnit instances that may also be provided (and when they are, they must be kept in sync).

link : tuple

Names of columns that form the DataUnit specific part of the primary-key in this DataUnit table and are also the names of the link column in the Datasets table.

table : sqlalchemy.core.Table, optional

When not None the primary table entry corresponding to this DataUnit.

spatial : bool, optional

Is this a spatial DataUnit? If so then it either has a region column, or some other way to get a region (e.g. SkyPix).

Attributes Summary

dependencies The union of requiredDependencies and optionalDependencies (frozenset, read-only).
link Names of columns that form the DataUnit specific part of the primary-key in this DataUnit table and are also the names of the link column in the Datasets table (tuple).
linkColumns Dictionary keyed on link names with sqlalchemy.Column entries into this DataUnit primary table as values (dict).
name Name of this DataUnit (str, read-only).
optionalDependencies Related DataUnit instances that may also be provided (and when they are, they must be kept in sync) (frozenset, read-only).
primaryKey Full primary-key column name tuple.
primaryKeyColumns Dictionary keyed on primaryKey names with sqlalchemy.Column entries into this DataUnit primary table as values (dict).
regionColumn Table column (sqlalchemy.Column) with encoded region data, None if table has no region column.
requiredDependencies Related DataUnit instances on which existence this DataUnit instance depends (frozenset, read-only).
spatial Is this a spatial DataUnitJoin?
table When not None the primary table entry corresponding to this DataUnit (sqlalchemy.core.Table, optional).

Methods Summary

validateId(dataId) Check if given dataId is valid.

Attributes Documentation

dependencies

The union of requiredDependencies and optionalDependencies (frozenset, read-only).

Names of columns that form the DataUnit specific part of the primary-key in this DataUnit table and are also the names of the link column in the Datasets table (tuple).

linkColumns

Dictionary keyed on link names with sqlalchemy.Column entries into this DataUnit primary table as values (dict).

name

Name of this DataUnit (str, read-only).

Also assumed to be the name of the primary table (if present).

optionalDependencies

Related DataUnit instances that may also be provided (and when they are, they must be kept in sync) (frozenset, read-only).

primaryKey

Full primary-key column name tuple. Consists of the link of this DataUnit and that of all its requiredDependencies (set).

primaryKeyColumns

Dictionary keyed on primaryKey names with sqlalchemy.Column entries into this DataUnit primary table as values (dict).

regionColumn

Table column (sqlalchemy.Column) with encoded region data, None if table has no region column.

requiredDependencies

Related DataUnit instances on which existence this DataUnit instance depends (frozenset, read-only).

spatial

Is this a spatial DataUnitJoin?

table

When not None the primary table entry corresponding to this DataUnit (sqlalchemy.core.Table, optional).

Methods Documentation

validateId(dataId)

Check if given dataId is valid.

Parameters:
dataId : dict

A dict of DataUnit link name, value pairs that label the DatasetRef within a Collection.

Raises:
ValueError

If a value for a required dependency is missing.