DimensionElement

class lsst.daf.butler.DimensionElement(name: str, *, directDependencyNames: Iterable[str] = (), impliedDependencyNames: Iterable[str] = (), spatial: bool = False, temporal: bool = False, metadata: Iterable[lsst.daf.butler.core.schema.FieldSpec] = (), cached: bool = False, viewOf: Optional[str] = None)

Bases: object

A named data-organization concept that defines a label and/or metadata in the dimensions system.

A DimensionElement instance typically corresponds to a table in the Registry; the rows in that table are represented by instances of a DimensionRecord subclass. Most DimensionElement instances are instances of its Dimension subclass, which is used for elements that can be used as data ID keys. The base class itself can be used for other dimension tables that provide metadata keyed by true dimensions.

Parameters:
name : str

Name of the element. Used as at least part of the table name, if the dimension in associated with a database table.

directDependencyNames : iterable of str

The names of all dimensions this elements depends on directly, including both required dimensions (those needed to identify a record of this element) an implied dimensions.

impliedDependencyNames : iterable of str

The names of all dimensions that are identified by records of this element, but are not needed to identify it.

spatial : bool

Whether records of this element are associated with a region on the sky.

temporal : bool

Whether records of this element are associated with a timespan.

metadata : iterable of FieldSpec

Additional metadata fields included in this element’s table.

cached : bool

Whether Registry should cache records of this element in-memory.

viewOf : str, optional

Name of another table this element’s records should be drawn from. The fields of this table must be a superset of the fields of the element.

Notes

DimensionElement instances should always be constructed by and retreived from a DimensionUniverse. They are immutable after they are fully constructed, and should never be copied.

Pickling a DimensionElement just records its name and universe; unpickling one actually just looks up the element via the singleton dictionary of all universes. This allows pickle to be used to transfer elements between processes, but only when each process initializes its own instance of the same DimensionUniverse.

Methods Summary

hasTable() Return True if this element is associated with a table (even if that table “belongs” to another element).
makeTableSpec() Return a specification of the schema for the table corresponding to this element.

Methods Documentation

hasTable() → bool

Return True if this element is associated with a table (even if that table “belongs” to another element).

Instances of the DimensionElement base class itself are always associated with tables.

makeTableSpec() → Optional[lsst.daf.butler.core.schema.TableSpec]

Return a specification of the schema for the table corresponding to this element.

This programmatically generates the primary and foreign key fields from the element’s dependencies and then appends any metadata fields.

Returns:
spec : TableSpec or None

Database-agnostic specification of the fields in this table.