LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Public Member Functions | Public Attributes | List of all members
lsst.daf.butlerUtils.mapping.CalibrationMapping Class Reference
Inheritance diagram for lsst.daf.butlerUtils.mapping.CalibrationMapping:
lsst.daf.butlerUtils.mapping.Mapping

Public Member Functions

def __init__
 
def lookup
 
def standardize
 
- Public Member Functions inherited from lsst.daf.butlerUtils.mapping.Mapping
def __init__
 
def keys
 
def map
 
def lookup
 
def have
 
def need
 

Public Attributes

 reference
 
 refCols
 
 refRegistry
 
 range
 
 columns
 
 setFilter
 
- Public Attributes inherited from lsst.daf.butlerUtils.mapping.Mapping
 datasetType
 
 registry
 
 root
 
 template
 
 keyDict
 
 python
 
 persistable
 
 storage
 
 level
 
 tables
 
 range
 
 columns
 
 obsTimeName
 

Detailed Description

CalibrationMapping is a Mapping subclass for calibration-type products.

The difference is that data properties in the query or template
can be looked up using a reference Mapping in addition to this one.

CalibrationMapping Policies can contain the following:

reference (string, optional): a list of tables for finding missing dataset
identifier components (including the observation time, if a validity range
is required) in the exposure registry; note that the "tables" entry refers
to the calibration registry

refCols (string, optional): a list of dataset properties required from the
reference tables for lookups in the calibration registry

validRange (bool): true if the calibration dataset has a validity range
specified by a column in the tables of the reference dataset in the
exposure registry) and two columns in the tables of this calibration
dataset in the calibration registry)

obsTimeName (string, optional): the name of the column in the reference
dataset tables containing the observation time (default "taiObs")

validStartName (string, optional): the name of the column in the
calibration dataset tables containing the start of the validity range
(default "validStart")

validEndName (string, optional): the name of the column in the
calibration dataset tables containing the end of the validity range
(default "validEnd") 

Definition at line 248 of file mapping.py.

Constructor & Destructor Documentation

def lsst.daf.butlerUtils.mapping.CalibrationMapping.__init__ (   self,
  datasetType,
  policy,
  registry,
  calibRegistry,
  calibRoot,
  kwargs 
)
Constructor for Mapping class.
@param datasetType    (string)
@param policy         (lsst.pex.policy.Policy) Mapping policy
@param registry       (lsst.daf.butlerUtils.Registry) Registry for metadata lookups
@param calibRegistry  (lsst.daf.butlerUtils.Registry) Registry for calibration metadata lookups
@param calibRoot      (string) Path of calibration root directory

Definition at line 280 of file mapping.py.

281  def __init__(self, datasetType, policy, registry, calibRegistry, calibRoot, **kwargs):
282  """Constructor for Mapping class.
283  @param datasetType (string)
284  @param policy (lsst.pex.policy.Policy) Mapping policy
285  @param registry (lsst.daf.butlerUtils.Registry) Registry for metadata lookups
286  @param calibRegistry (lsst.daf.butlerUtils.Registry) Registry for calibration metadata lookups
287  @param calibRoot (string) Path of calibration root directory"""
288 
289  Mapping.__init__(self, datasetType, policy, calibRegistry, calibRoot, **kwargs)
290  self.reference = policy.getStringArray("reference") \
291  if policy.exists("reference") else None
292  self.refCols = policy.getStringArray("refCols") \
293  if policy.exists("refCols") else None
294  self.refRegistry = registry
295  if policy.exists("validRange") and policy.getBool("validRange"):
296  self.range = ("?", policy.getString("validStartName"),
297  policy.getString("validEndName"))
298  if policy.exists("columns"):
299  self.columns = policy.getStringArray("columns")
300  if policy.exists("filter"):
301  self.setFilter = policy.getBool("filter")

Member Function Documentation

def lsst.daf.butlerUtils.mapping.CalibrationMapping.lookup (   self,
  properties,
  dataId 
)
Look up properties for in a metadata registry given a partial
dataset identifier.
@param properties (list of strings)
@param dataId     (dict) Dataset identifier
@return (list of tuples) values of properties

Definition at line 302 of file mapping.py.

303  def lookup(self, properties, dataId):
304  """Look up properties for in a metadata registry given a partial
305  dataset identifier.
306  @param properties (list of strings)
307  @param dataId (dict) Dataset identifier
308  @return (list of tuples) values of properties"""
309 
310 # Either look up taiObs in reference and then all in calibRegistry
311 # Or look up all in registry
312 
313  newId = dataId.copy()
314  if self.reference is not None:
315  where = []
316  values = []
317  for k, v in dataId.iteritems():
318  if self.refCols and k not in self.refCols:
319  continue
320  where.append((k, '?'))
321  values.append(v)
322 
323  # Columns we need from the regular registry
324  if self.columns is not None:
325  columns = set(self.columns)
326  for k in dataId.iterkeys():
327  columns.discard(k)
328  else:
329  columns = set(properties)
330 
331  if not columns:
332  # Nothing to lookup in reference registry; continue with calib
333  # registry
334  return Mapping.lookup(self, properties, newId)
335 
336  lookups = self.refRegistry.executeQuery(columns, self.reference,
337  where, None, values)
338  if len(lookups) != 1:
339  raise RuntimeError("No unique lookup for %s from %s: %d matches" %
340  (columns, dataId, len(lookups)))
341  if columns == set(properties):
342  # Have everything we need
343  return lookups
344  for i, prop in enumerate(columns):
345  newId[prop] = lookups[0][i]
346  return Mapping.lookup(self, properties, newId)
def lsst.daf.butlerUtils.mapping.CalibrationMapping.standardize (   self,
  mapper,
  item,
  dataId 
)

Definition at line 347 of file mapping.py.

348  def standardize(self, mapper, item, dataId):
349  return mapper._standardizeExposure(self, item, dataId, filter=self.setFilter)

Member Data Documentation

lsst.daf.butlerUtils.mapping.CalibrationMapping.columns

Definition at line 298 of file mapping.py.

lsst.daf.butlerUtils.mapping.CalibrationMapping.range

Definition at line 295 of file mapping.py.

lsst.daf.butlerUtils.mapping.CalibrationMapping.refCols

Definition at line 291 of file mapping.py.

lsst.daf.butlerUtils.mapping.CalibrationMapping.reference

Definition at line 289 of file mapping.py.

lsst.daf.butlerUtils.mapping.CalibrationMapping.refRegistry

Definition at line 293 of file mapping.py.

lsst.daf.butlerUtils.mapping.CalibrationMapping.setFilter

Definition at line 300 of file mapping.py.


The documentation for this class was generated from the following file: