Mapping

class lsst.obs.base.Mapping(datasetType, policy, registry, rootStorage, provided=None)

Bases: object

Mapping is a base class for all mappings. Mappings are used by the Mapper to map (determine a path to some data given some identifiers) and standardize (convert data into some standard format or type) data, and to query the associated registry to see what data is available.

Subclasses must specify self.storage or else override self.map().

Public methods: lookup, have, need, getKeys, map

Mappings are specified mainly by policy. A Mapping policy should consist of:

template (string): a Python string providing the filename for that particular dataset type based on some data identifiers. In the case of redundancy in the path (e.g., file uniquely specified by the exposure number, but filter in the path), the redundant/dependent identifiers can be looked up in the registry.

python (string): the Python type for the retrieved data (e.g. lsst.afw.image.ExposureF)

persistable (string): the Persistable registration for the on-disk data (e.g. ImageU)

storage (string, optional): Storage type for this dataset type (e.g. “FitsStorage”)

level (string, optional): the level in the camera hierarchy at which the data is stored (Amp, Ccd or skyTile), if relevant

tables (string, optional): a whitespace-delimited list of tables in the registry that can be NATURAL JOIN-ed to look up additional information.

Parameters:
datasetType : str

Butler dataset type to be mapped.

policy : daf_persistence.Policy

Mapping Policy.

registry : lsst.obs.base.Registry

Registry for metadata lookups.

rootStorage : Storage subclass instance

Interface to persisted repository data.

provided : list of str

Keys provided by the mapper.

Attributes Summary

template

Methods Summary

have(properties, dataId) Returns whether the provided data identifier has all the properties in the provided list.
keys() Return the dict of keys and value types required for this mapping.
lookup(properties, dataId) Look up properties for in a metadata registry given a partial dataset identifier.
map(mapper, dataId[, write]) Standard implementation of map function.
need(properties, dataId) Ensures all properties in the provided list are present in the data identifier, looking them up as needed.

Attributes Documentation

template

Methods Documentation

have(properties, dataId)

Returns whether the provided data identifier has all the properties in the provided list.

Parameters:
properties : list of `str

Properties required.

dataId : dict

Dataset identifier.

Returns:
bool

True if all properties are present.

keys()

Return the dict of keys and value types required for this mapping.

lookup(properties, dataId)

Look up properties for in a metadata registry given a partial dataset identifier.

Parameters:
properties : list of str

What to look up.

dataId : dict

Dataset identifier

Returns:
list of tuple

Values of properties.

map(mapper, dataId, write=False)

Standard implementation of map function.

Parameters:
mapper: `lsst.daf.persistence.Mapper`

Object to be mapped.

dataId: `dict`

Dataset identifier.

Returns:
lsst.daf.persistence.ButlerLocation

Location of object that was mapped.

need(properties, dataId)

Ensures all properties in the provided list are present in the data identifier, looking them up as needed. This is only possible for the case where the data identifies a single exposure.

Parameters:
properties : list of str

Properties required.

dataId : dict

Partial dataset identifier

Returns:
dict

Copy of dataset identifier with enhanced values.