DataUnitRegistry

class lsst.daf.butler.DataUnitRegistry

Bases: object

Instances of this class keep track of DataUnit relations.

Entries in this dict-like object represent DataUnit instances, keyed on DataUnit names.

Methods Summary

fromConfig(config) Alternative constructor.
getByLinkName(name) Get a DataUnit for which name is part of the link.
getJoin(lhs, rhs) Return the DataUnitJoin that relates the given DataUnit names.
getPrimaryKeyNames(dataUnitNames) Get all primary-key column names for the given dataUnitNames.
getRegionHolder(*dataUnits) Return the DataUnit or DataUnitJoin that holds region for the given combination of DataUnits.
items()
keys()
values()

Methods Documentation

classmethod fromConfig(config)

Alternative constructor.

Build a DataUnitRegistry instance from a Config object.

Parameters:
config : DataUnitConfig

DataUnit configuration containing “dimensions”, “joins” entries.

getByLinkName(name)

Get a DataUnit for which name is part of the link.

Parameters:
name : str

Link name.

Returns:
dataUnit : DataUnit

The corresponding DataUnit instance.

Raises:
KeyError

When the provided name does not correspond to a link for any of the DataUnit entries in the registry.

getJoin(lhs, rhs)

Return the DataUnitJoin that relates the given DataUnit names.

While DataUnitJoins are associated with a specific ordering or lhs and rhs, this method tries both.

Parameters:
lhs : str or sequence

DataUnit name or sequence of names for one side of the join.

rhs : str or sequence

DataUnit name or sequence of names for the other side of the join.

Returns:
join : DataUnitJoin

The DataUnitJoin that relates the given DataUnits, or None.

getPrimaryKeyNames(dataUnitNames)

Get all primary-key column names for the given dataUnitNames.

Parameters:
dataUnitNames : sequence

A sequence of DataUnit names.

Returns:
primaryKeyNames : set

All primary-key column names for the given dataUnitNames.

getRegionHolder(*dataUnits)

Return the DataUnit or DataUnitJoin that holds region for the given combination of DataUnits.

Arguments may be either DataUnit instances or their names (but not link names), and required dependencies may or may not be included. Optional dependencies must not be included.

Returned object can be either DataUnitJoin or DataUnit. Use table and/or regionColumn properties of returned object to retrieve region data from database table.

Returns:
`DataUnitJoin` or `DataUnit` instance.
Raises:
KeyError

Raised if there is no Region associated with the given combination of DataUnits.

items()
keys()
values()