lsst.obs.base  20.0.0-51-g885a4e5+9bf1eb8e0a
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
lsst.obs.base.cameraMapper.CameraMapper Class Reference
Inheritance diagram for lsst.obs.base.cameraMapper.CameraMapper:
lsst.obs.base.test.baseMapper.BaseMapper lsst.obs.base.test.compositeMapper.CompositeMapper

Public Member Functions

def __init__ (self, policy, repositoryDir, root=None, registry=None, calibRoot=None, calibRegistry=None, provided=None, parentRegistry=None, repositoryCfg=None)
 
def backup (self, datasetType, dataId)
 
def keys (self)
 
def getKeys (self, datasetType, level)
 
def getDefaultLevel (self)
 
def getDefaultSubLevel (self, level)
 
def getCameraName (cls)
 
def getPackageName (cls)
 
def getGen3Instrument (cls)
 
def getPackageDir (cls)
 
def map_camera (self, dataId, write=False)
 
def bypass_camera (self, datasetType, pythonType, butlerLocation, dataId)
 
def map_expIdInfo (self, dataId, write=False)
 
def bypass_expIdInfo (self, datasetType, pythonType, location, dataId)
 
def std_bfKernel (self, item, dataId)
 
def std_raw (self, item, dataId)
 
def map_skypolicy (self, dataId)
 
def std_skypolicy (self, item, dataId)
 
def getRegistry (self)
 
def getImageCompressionSettings (self, datasetType, dataId)
 

Static Public Member Functions

def getShortCcdName (ccdName)
 

Public Attributes

 log
 
 root
 
 levels
 
 defaultLevel
 
 defaultSubLevels
 
 rootStorage
 
 registry
 
 calibRegistry
 
 keyDict
 
 cameraDataLocation
 
 camera
 
 filters
 
 makeRawVisitInfo
 
 mappings
 

Static Public Attributes

 packageName = None
 
 MakeRawVisitInfoClass = MakeRawVisitInfo
 
 PupilFactoryClass = afwCameraGeom.PupilFactory
 
 translatorClass = None
 

Detailed Description

CameraMapper is a base class for mappers that handle images from a
camera and products derived from them.  This provides an abstraction layer
between the data on disk and the code.

Public methods: keys, queryMetadata, getDatasetTypes, map,
canStandardize, standardize

Mappers for specific data sources (e.g., CFHT Megacam, LSST
simulations, etc.) should inherit this class.

The CameraMapper manages datasets within a "root" directory. Note that
writing to a dataset present in the input root will hide the existing
dataset but not overwrite it.  See #2160 for design discussion.

A camera is assumed to consist of one or more rafts, each composed of
multiple CCDs.  Each CCD is in turn composed of one or more amplifiers
(amps).  A camera is also assumed to have a camera geometry description
(CameraGeom object) as a policy file, a filter description (Filter class
static configuration) as another policy file.

Information from the camera geometry and defects are inserted into all
Exposure objects returned.

The mapper uses one or two registries to retrieve metadata about the
images.  The first is a registry of all raw exposures.  This must contain
the time of the observation.  One or more tables (or the equivalent)
within the registry are used to look up data identifier components that
are not specified by the user (e.g. filter) and to return results for
metadata queries.  The second is an optional registry of all calibration
data.  This should contain validity start and end entries for each
calibration dataset in the same timescale as the observation time.

Subclasses will typically set MakeRawVisitInfoClass and optionally the
metadata translator class:

MakeRawVisitInfoClass: a class variable that points to a subclass of
MakeRawVisitInfo, a functor that creates an
lsst.afw.image.VisitInfo from the FITS metadata of a raw image.

translatorClass: The `~astro_metadata_translator.MetadataTranslator`
class to use for fixing metadata values.  If it is not set an attempt
will be made to infer the class from ``MakeRawVisitInfoClass``, failing
that the metadata fixup will try to infer the translator class from the
header itself.

Subclasses must provide the following methods:

_extractDetectorName(self, dataId): returns the detector name for a CCD
(e.g., "CFHT 21", "R:1,2 S:3,4") as used in the AFW CameraGeom class given
a dataset identifier referring to that CCD or a subcomponent of it.

_computeCcdExposureId(self, dataId): see below

_computeCoaddExposureId(self, dataId, singleFilter): see below

Subclasses may also need to override the following methods:

_transformId(self, dataId): transformation of a data identifier
from colloquial usage (e.g., "ccdname") to proper/actual usage
(e.g., "ccd"), including making suitable for path expansion (e.g. removing
commas). The default implementation does nothing.  Note that this
method should not modify its input parameter.

getShortCcdName(self, ccdName): a static method that returns a shortened
name suitable for use as a filename. The default version converts spaces
to underscores.

_mapActualToPath(self, template, actualId): convert a template path to an
actual path, using the actual dataset identifier.

The mapper's behaviors are largely specified by the policy file.
See the MapperDictionary.paf for descriptions of the available items.

The 'exposures', 'calibrations', and 'datasets' subpolicies configure
mappings (see Mappings class).

Common default mappings for all subclasses can be specified in the
"policy/{images,exposures,calibrations,datasets}.yaml" files. This
provides a simple way to add a product to all camera mappers.

Functions to map (provide a path to the data given a dataset
identifier dictionary) and standardize (convert data into some standard
format or type) may be provided in the subclass as "map_{dataset type}"
and "std_{dataset type}", respectively.

If non-Exposure datasets cannot be retrieved using standard
daf_persistence methods alone, a "bypass_{dataset type}" function may be
provided in the subclass to return the dataset instead of using the
"datasets" subpolicy.

Implementations of map_camera and bypass_camera that should typically be
sufficient are provided in this base class.

Notes
-----
.. todo::

   Instead of auto-loading the camera at construction time, load it from
   the calibration registry

Parameters
----------
policy : daf_persistence.Policy,
    Policy with per-camera defaults already merged.
repositoryDir : string
    Policy repository for the subclassing module (obtained with
    getRepositoryPath() on the per-camera default dictionary).
root : string, optional
    Path to the root directory for data.
registry : string, optional
    Path to registry with data's metadata.
calibRoot : string, optional
    Root directory for calibrations.
calibRegistry : string, optional
    Path to registry with calibrations' metadata.
provided : list of string, optional
    Keys provided by the mapper.
parentRegistry : Registry subclass, optional
    Registry from a parent repository that may be used to look up
    data's metadata.
repositoryCfg : daf_persistence.RepositoryCfg or None, optional
    The configuration information for the repository this mapper is
    being used with.

Definition at line 49 of file cameraMapper.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.obs.base.cameraMapper.CameraMapper.__init__ (   self,
  policy,
  repositoryDir,
  root = None,
  registry = None,
  calibRoot = None,
  calibRegistry = None,
  provided = None,
  parentRegistry = None,
  repositoryCfg = None 
)

Definition at line 191 of file cameraMapper.py.

Member Function Documentation

◆ backup()

def lsst.obs.base.cameraMapper.CameraMapper.backup (   self,
  datasetType,
  dataId 
)
Rename any existing object with the given type and dataId.

The CameraMapper implementation saves objects in a sequence of e.g.:

- foo.fits
- foo.fits~1
- foo.fits~2

All of the backups will be placed in the output repo, however, and will
not be removed if they are found elsewhere in the _parent chain.  This
means that the same file will be stored twice if the previous version
was found in an input repo.

Definition at line 597 of file cameraMapper.py.

◆ bypass_camera()

def lsst.obs.base.cameraMapper.CameraMapper.bypass_camera (   self,
  datasetType,
  pythonType,
  butlerLocation,
  dataId 
)
Return the (preloaded) camera object.

Definition at line 748 of file cameraMapper.py.

◆ bypass_expIdInfo()

def lsst.obs.base.cameraMapper.CameraMapper.bypass_expIdInfo (   self,
  datasetType,
  pythonType,
  location,
  dataId 
)
Hook to retrieve an lsst.obs.base.ExposureIdInfo for an exposure

Definition at line 766 of file cameraMapper.py.

◆ getCameraName()

def lsst.obs.base.cameraMapper.CameraMapper.getCameraName (   cls)
Return the name of the camera that this CameraMapper is for.

Definition at line 691 of file cameraMapper.py.

◆ getDefaultLevel()

def lsst.obs.base.cameraMapper.CameraMapper.getDefaultLevel (   self)

Definition at line 682 of file cameraMapper.py.

◆ getDefaultSubLevel()

def lsst.obs.base.cameraMapper.CameraMapper.getDefaultSubLevel (   self,
  level 
)

Definition at line 685 of file cameraMapper.py.

◆ getGen3Instrument()

def lsst.obs.base.cameraMapper.CameraMapper.getGen3Instrument (   cls)
Return the gen3 Instrument class equivalent for this gen2 Mapper.

Returns
-------
instr : `type`
    A `~lsst.obs.base.Instrument` class.

Definition at line 709 of file cameraMapper.py.

◆ getImageCompressionSettings()

def lsst.obs.base.cameraMapper.CameraMapper.getImageCompressionSettings (   self,
  datasetType,
  dataId 
)
Stuff image compression settings into a daf.base.PropertySet

This goes into the ButlerLocation's "additionalData", which gets
passed into the boost::persistence framework.

Parameters
----------
datasetType : `str`
    Type of dataset for which to get the image compression settings.
dataId : `dict`
    Dataset identifier.

Returns
-------
additionalData : `lsst.daf.base.PropertySet`
    Image compression settings.

Definition at line 1202 of file cameraMapper.py.

◆ getKeys()

def lsst.obs.base.cameraMapper.CameraMapper.getKeys (   self,
  datasetType,
  level 
)
Return a dict of supported keys and their value types for a given
dataset type at a given level of the key hierarchy.

Parameters
----------
datasetType :  `str`
    Dataset type or None for all dataset types.
level :  `str` or None
    Level or None for all levels or '' for the default level for the
    camera.

Returns
-------
`dict`
    Keys are strings usable in a dataset identifier, values are their
    value types.

Definition at line 648 of file cameraMapper.py.

◆ getPackageDir()

def lsst.obs.base.cameraMapper.CameraMapper.getPackageDir (   cls)
Return the base directory of this package

Reimplemented in lsst.obs.base.test.baseMapper.BaseMapper.

Definition at line 729 of file cameraMapper.py.

◆ getPackageName()

def lsst.obs.base.cameraMapper.CameraMapper.getPackageName (   cls)
Return the name of the package containing this CameraMapper.

Definition at line 702 of file cameraMapper.py.

◆ getRegistry()

def lsst.obs.base.cameraMapper.CameraMapper.getRegistry (   self)
Get the registry used by this mapper.

Returns
-------
Registry or None
    The registry used by this mapper for this mapper's repository.

Definition at line 1192 of file cameraMapper.py.

◆ getShortCcdName()

def lsst.obs.base.cameraMapper.CameraMapper.getShortCcdName (   ccdName)
static
Convert a CCD name to a form useful as a filename

The default implementation converts spaces to underscores.

Definition at line 958 of file cameraMapper.py.

◆ keys()

def lsst.obs.base.cameraMapper.CameraMapper.keys (   self)
Return supported keys.

Returns
-------
iterable
    List of keys usable in a dataset identifier

Definition at line 638 of file cameraMapper.py.

◆ map_camera()

def lsst.obs.base.cameraMapper.CameraMapper.map_camera (   self,
  dataId,
  write = False 
)
Map a camera dataset.

Definition at line 733 of file cameraMapper.py.

◆ map_expIdInfo()

def lsst.obs.base.cameraMapper.CameraMapper.map_expIdInfo (   self,
  dataId,
  write = False 
)

Definition at line 755 of file cameraMapper.py.

◆ map_skypolicy()

def lsst.obs.base.cameraMapper.CameraMapper.map_skypolicy (   self,
  dataId 
)
Map a sky policy.

Definition at line 788 of file cameraMapper.py.

◆ std_bfKernel()

def lsst.obs.base.cameraMapper.CameraMapper.std_bfKernel (   self,
  item,
  dataId 
)
Disable standardization for bfKernel

bfKernel is a calibration product that is numpy array,
unlike other calibration products that are all images;
all calibration images are sent through _standardizeExposure
due to CalibrationMapping, but we don't want that to happen to bfKernel

Definition at line 772 of file cameraMapper.py.

◆ std_raw()

def lsst.obs.base.cameraMapper.CameraMapper.std_raw (   self,
  item,
  dataId 
)
Standardize a raw dataset by converting it to an Exposure instead
of an Image

Definition at line 782 of file cameraMapper.py.

◆ std_skypolicy()

def lsst.obs.base.cameraMapper.CameraMapper.std_skypolicy (   self,
  item,
  dataId 
)
Standardize a sky policy by returning the one we use.

Definition at line 794 of file cameraMapper.py.

Member Data Documentation

◆ calibRegistry

lsst.obs.base.cameraMapper.CameraMapper.calibRegistry

Definition at line 255 of file cameraMapper.py.

◆ camera

lsst.obs.base.cameraMapper.CameraMapper.camera

Definition at line 273 of file cameraMapper.py.

◆ cameraDataLocation

lsst.obs.base.cameraMapper.CameraMapper.cameraDataLocation

Definition at line 272 of file cameraMapper.py.

◆ defaultLevel

lsst.obs.base.cameraMapper.CameraMapper.defaultLevel

Definition at line 214 of file cameraMapper.py.

◆ defaultSubLevels

lsst.obs.base.cameraMapper.CameraMapper.defaultSubLevels

Definition at line 215 of file cameraMapper.py.

◆ filters

lsst.obs.base.cameraMapper.CameraMapper.filters

Definition at line 276 of file cameraMapper.py.

◆ keyDict

lsst.obs.base.cameraMapper.CameraMapper.keyDict

Definition at line 266 of file cameraMapper.py.

◆ levels

lsst.obs.base.cameraMapper.CameraMapper.levels

Definition at line 209 of file cameraMapper.py.

◆ log

lsst.obs.base.cameraMapper.CameraMapper.log

Definition at line 195 of file cameraMapper.py.

◆ makeRawVisitInfo

lsst.obs.base.cameraMapper.CameraMapper.makeRawVisitInfo

Definition at line 283 of file cameraMapper.py.

◆ MakeRawVisitInfoClass

lsst.obs.base.cameraMapper.CameraMapper.MakeRawVisitInfoClass = MakeRawVisitInfo
static

Definition at line 179 of file cameraMapper.py.

◆ mappings

lsst.obs.base.cameraMapper.CameraMapper.mappings

Definition at line 336 of file cameraMapper.py.

◆ packageName

lsst.obs.base.cameraMapper.CameraMapper.packageName = None
static

Definition at line 175 of file cameraMapper.py.

◆ PupilFactoryClass

lsst.obs.base.cameraMapper.CameraMapper.PupilFactoryClass = afwCameraGeom.PupilFactory
static

Definition at line 182 of file cameraMapper.py.

◆ registry

lsst.obs.base.cameraMapper.CameraMapper.registry

Definition at line 247 of file cameraMapper.py.

◆ root

lsst.obs.base.cameraMapper.CameraMapper.root

Definition at line 198 of file cameraMapper.py.

◆ rootStorage

lsst.obs.base.cameraMapper.CameraMapper.rootStorage

Definition at line 224 of file cameraMapper.py.

◆ translatorClass

lsst.obs.base.cameraMapper.CameraMapper.translatorClass = None
static

Definition at line 185 of file cameraMapper.py.


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