LSSTApplications  17.0+124,17.0+14,17.0+73,18.0.0+37,18.0.0+80,18.0.0-4-g68ffd23+4,18.1.0-1-g0001055+12,18.1.0-1-g03d53ef+5,18.1.0-1-g1349e88+55,18.1.0-1-g2505f39+44,18.1.0-1-g5315e5e+4,18.1.0-1-g5e4b7ea+14,18.1.0-1-g7e8fceb+4,18.1.0-1-g85f8cd4+48,18.1.0-1-g8ff0b9f+4,18.1.0-1-ga2c679d+1,18.1.0-1-gd55f500+35,18.1.0-10-gb58edde+2,18.1.0-11-g0997b02+4,18.1.0-13-gfe4edf0b+12,18.1.0-14-g259bd21+21,18.1.0-19-gdb69f3f+2,18.1.0-2-g5f9922c+24,18.1.0-2-gd3b74e5+11,18.1.0-2-gfbf3545+32,18.1.0-26-g728bddb4+5,18.1.0-27-g6ff7ca9+2,18.1.0-3-g52aa583+25,18.1.0-3-g8ea57af+9,18.1.0-3-gb69f684+42,18.1.0-3-gfcaddf3+6,18.1.0-32-gd8786685a,18.1.0-4-gf3f9b77+6,18.1.0-5-g1dd662b+2,18.1.0-5-g6dbcb01+41,18.1.0-6-gae77429+3,18.1.0-7-g9d75d83+9,18.1.0-7-gae09a6d+30,18.1.0-9-gc381ef5+4,w.2019.45
LSSTDataManagementBasePackage
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.daf.persistence.mapper.Mapper lsst.obs.base.test.compositeMapper.CompositeMapper lsst.obs.decam.decamMapper.DecamMapper lsst.obs.test.testMapper.MapperForTestCalexpMetadataObjects lsst.obs.test.testMapper.TestMapper

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 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)
 
def __new__ (cls, args, kwargs)
 
def __getstate__ (self)
 
def __setstate__ (self, state)
 
def queryMetadata (self, datasetType, format, dataId)
 
def getDatasetTypes (self)
 
def map (self, datasetType, dataId, write=False)
 
def canStandardize (self, datasetType)
 
def standardize (self, datasetType, item, dataId)
 
def validate (self, 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
 
 category
 

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 50 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 190 of file cameraMapper.py.

190  provided=None, parentRegistry=None, repositoryCfg=None):
191 
192  dafPersist.Mapper.__init__(self)
193 
194  self.log = lsstLog.Log.getLogger("CameraMapper")
195 
196  if root:
197  self.root = root
198  elif repositoryCfg:
199  self.root = repositoryCfg.root
200  else:
201  self.root = None
202 
203  repoPolicy = repositoryCfg.policy if repositoryCfg else None
204  if repoPolicy is not None:
205  policy.update(repoPolicy)
206 
207  # Levels
208  self.levels = dict()
209  if 'levels' in policy:
210  levelsPolicy = policy['levels']
211  for key in levelsPolicy.names(True):
212  self.levels[key] = set(levelsPolicy.asArray(key))
213  self.defaultLevel = policy['defaultLevel']
214  self.defaultSubLevels = dict()
215  if 'defaultSubLevels' in policy:
216  self.defaultSubLevels = policy['defaultSubLevels']
217 
218  # Root directories
219  if root is None:
220  root = "."
221  root = dafPersist.LogicalLocation(root).locString()
222 
223  self.rootStorage = dafPersist.Storage.makeFromURI(uri=root)
224 
225  # If the calibRoot is passed in, use that. If not and it's indicated in
226  # the policy, use that. And otherwise, the calibs are in the regular
227  # root.
228  # If the location indicated by the calib root does not exist, do not
229  # create it.
230  calibStorage = None
231  if calibRoot is not None:
232  calibRoot = dafPersist.Storage.absolutePath(root, calibRoot)
233  calibStorage = dafPersist.Storage.makeFromURI(uri=calibRoot,
234  create=False)
235  else:
236  calibRoot = policy.get('calibRoot', None)
237  if calibRoot:
238  calibStorage = dafPersist.Storage.makeFromURI(uri=calibRoot,
239  create=False)
240  if calibStorage is None:
241  calibStorage = self.rootStorage
242 
243  self.root = root
244 
245  # Registries
246  self.registry = self._setupRegistry("registry", "exposure", registry, policy, "registryPath",
247  self.rootStorage, searchParents=False,
248  posixIfNoSql=(not parentRegistry))
249  if not self.registry:
250  self.registry = parentRegistry
251  needCalibRegistry = policy.get('needCalibRegistry', None)
252  if needCalibRegistry:
253  if calibStorage:
254  self.calibRegistry = self._setupRegistry("calibRegistry", "calib", calibRegistry, policy,
255  "calibRegistryPath", calibStorage,
256  posixIfNoSql=False) # NB never use posix for calibs
257  else:
258  raise RuntimeError(
259  "'needCalibRegistry' is true in Policy, but was unable to locate a repo at " +
260  "calibRoot ivar:%s or policy['calibRoot']:%s" %
261  (calibRoot, policy.get('calibRoot', None)))
262  else:
263  self.calibRegistry = None
264 
265  # Dict of valid keys and their value types
266  self.keyDict = dict()
267 
268  self._initMappings(policy, self.rootStorage, calibStorage, provided=None)
269  self._initWriteRecipes()
270 
271  # Camera geometry
272  self.cameraDataLocation = None # path to camera geometry config file
273  self.camera = self._makeCamera(policy=policy, repositoryDir=repositoryDir)
274 
275  # Filter translation table
276  self.filters = None
277 
278  # verify that the class variable packageName is set before attempting
279  # to instantiate an instance
280  if self.packageName is None:
281  raise ValueError('class variable packageName must not be None')
282 
283  self.makeRawVisitInfo = self.MakeRawVisitInfoClass(log=self.log)
284 
285  # Assign a metadata translator if one has not been defined by
286  # subclass. We can sometimes infer one from the RawVisitInfo
287  # class.
288  if self.translatorClass is None and hasattr(self.makeRawVisitInfo, "metadataTranslator"):
289  self.translatorClass = self.makeRawVisitInfo.metadataTranslator
290 
Class for logical location of a persisted Persistable instance.
daf::base::PropertySet * set
Definition: fits.cc:902

Member Function Documentation

◆ __getstate__()

def lsst.daf.persistence.mapper.Mapper.__getstate__ (   self)
inherited

Definition at line 104 of file mapper.py.

104  def __getstate__(self):
105  return self._arguments
106 

◆ __new__()

def lsst.daf.persistence.mapper.Mapper.__new__ (   cls,
  args,
  kwargs 
)
inherited
Create a new Mapper, saving arguments for pickling.

This is in __new__ instead of __init__ to save the user
from having to save the arguments themselves (either explicitly,
or by calling the super's __init__ with all their
*args,**kwargs.  The resulting pickling system (of __new__,
__getstate__ and __setstate__ is similar to how __reduce__
is usually used, except that we save the user from any
responsibility (except when overriding __new__, but that
is not common).

Definition at line 85 of file mapper.py.

85  def __new__(cls, *args, **kwargs):
86  """Create a new Mapper, saving arguments for pickling.
87 
88  This is in __new__ instead of __init__ to save the user
89  from having to save the arguments themselves (either explicitly,
90  or by calling the super's __init__ with all their
91  *args,**kwargs. The resulting pickling system (of __new__,
92  __getstate__ and __setstate__ is similar to how __reduce__
93  is usually used, except that we save the user from any
94  responsibility (except when overriding __new__, but that
95  is not common).
96  """
97  self = super().__new__(cls)
98  self._arguments = (args, kwargs)
99  return self
100 

◆ __setstate__()

def lsst.daf.persistence.mapper.Mapper.__setstate__ (   self,
  state 
)
inherited

Definition at line 107 of file mapper.py.

107  def __setstate__(self, state):
108  self._arguments = state
109  args, kwargs = state
110  self.__init__(*args, **kwargs)
111 

◆ 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 595 of file cameraMapper.py.

595  def backup(self, datasetType, dataId):
596  """Rename any existing object with the given type and dataId.
597 
598  The CameraMapper implementation saves objects in a sequence of e.g.:
599 
600  - foo.fits
601  - foo.fits~1
602  - foo.fits~2
603 
604  All of the backups will be placed in the output repo, however, and will
605  not be removed if they are found elsewhere in the _parent chain. This
606  means that the same file will be stored twice if the previous version
607  was found in an input repo.
608  """
609 
610  # Calling PosixStorage directly is not the long term solution in this
611  # function, this is work-in-progress on epic DM-6225. The plan is for
612  # parentSearch to be changed to 'search', and search only the storage
613  # associated with this mapper. All searching of parents will be handled
614  # by traversing the container of repositories in Butler.
615 
616  def firstElement(list):
617  """Get the first element in the list, or None if that can't be
618  done.
619  """
620  return list[0] if list is not None and len(list) else None
621 
622  n = 0
623  newLocation = self.map(datasetType, dataId, write=True)
624  newPath = newLocation.getLocations()[0]
625  path = dafPersist.PosixStorage.search(self.root, newPath, searchParents=True)
626  path = firstElement(path)
627  oldPaths = []
628  while path is not None:
629  n += 1
630  oldPaths.append((n, path))
631  path = dafPersist.PosixStorage.search(self.root, "%s~%d" % (newPath, n), searchParents=True)
632  path = firstElement(path)
633  for n, oldPath in reversed(oldPaths):
634  self.rootStorage.copyFile(oldPath, "%s~%d" % (newPath, n))
635 

◆ bypass_camera()

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

Definition at line 726 of file cameraMapper.py.

726  def bypass_camera(self, datasetType, pythonType, butlerLocation, dataId):
727  """Return the (preloaded) camera object.
728  """
729  if self.camera is None:
730  raise RuntimeError("No camera dataset available.")
731  return self.camera
732 

◆ 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 744 of file cameraMapper.py.

744  def bypass_expIdInfo(self, datasetType, pythonType, location, dataId):
745  """Hook to retrieve an lsst.obs.base.ExposureIdInfo for an exposure"""
746  expId = self.bypass_ccdExposureId(datasetType, pythonType, location, dataId)
747  expBits = self.bypass_ccdExposureId_bits(datasetType, pythonType, location, dataId)
748  return ExposureIdInfo(expId=expId, expBits=expBits)
749 

◆ canStandardize()

def lsst.daf.persistence.mapper.Mapper.canStandardize (   self,
  datasetType 
)
inherited
Return true if this mapper can standardize an object of the given
dataset type.

Definition at line 168 of file mapper.py.

168  def canStandardize(self, datasetType):
169  """Return true if this mapper can standardize an object of the given
170  dataset type."""
171 
172  return hasattr(self, 'std_' + datasetType)
173 

◆ getCameraName()

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

Definition at line 689 of file cameraMapper.py.

689  def getCameraName(cls):
690  """Return the name of the camera that this CameraMapper is for."""
691  className = str(cls)
692  className = className[className.find('.'):-1]
693  m = re.search(r'(\w+)Mapper', className)
694  if m is None:
695  m = re.search(r"class '[\w.]*?(\w+)'", className)
696  name = m.group(1)
697  return name[:1].lower() + name[1:] if name else ''
698 

◆ getDatasetTypes()

def lsst.daf.persistence.mapper.Mapper.getDatasetTypes (   self)
inherited
Return a list of the mappable dataset types.

Definition at line 129 of file mapper.py.

129  def getDatasetTypes(self):
130  """Return a list of the mappable dataset types."""
131 
132  list = []
133  for attr in dir(self):
134  if attr.startswith("map_"):
135  list.append(attr[4:])
136  return list
137 

◆ getDefaultLevel()

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

Definition at line 680 of file cameraMapper.py.

680  def getDefaultLevel(self):
681  return self.defaultLevel
682 

◆ getDefaultSubLevel()

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

Definition at line 683 of file cameraMapper.py.

683  def getDefaultSubLevel(self, level):
684  if level in self.defaultSubLevels:
685  return self.defaultSubLevels[level]
686  return None
687 

◆ 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.

1202  def getImageCompressionSettings(self, datasetType, dataId):
1203  """Stuff image compression settings into a daf.base.PropertySet
1204 
1205  This goes into the ButlerLocation's "additionalData", which gets
1206  passed into the boost::persistence framework.
1207 
1208  Parameters
1209  ----------
1210  datasetType : `str`
1211  Type of dataset for which to get the image compression settings.
1212  dataId : `dict`
1213  Dataset identifier.
1214 
1215  Returns
1216  -------
1217  additionalData : `lsst.daf.base.PropertySet`
1218  Image compression settings.
1219  """
1220  mapping = self.mappings[datasetType]
1221  recipeName = mapping.recipe
1222  storageType = mapping.storage
1223  if storageType not in self._writeRecipes:
1224  return dafBase.PropertySet()
1225  if recipeName not in self._writeRecipes[storageType]:
1226  raise RuntimeError("Unrecognized write recipe for datasetType %s (storage type %s): %s" %
1227  (datasetType, storageType, recipeName))
1228  recipe = self._writeRecipes[storageType][recipeName].deepCopy()
1229  seed = hash(tuple(dataId.items())) % 2**31
1230  for plane in ("image", "mask", "variance"):
1231  if recipe.exists(plane + ".scaling.seed") and recipe.getScalar(plane + ".scaling.seed") == 0:
1232  recipe.set(plane + ".scaling.seed", seed)
1233  return recipe
1234 
Class for storing generic metadata.
Definition: PropertySet.h:67

◆ 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 646 of file cameraMapper.py.

646  def getKeys(self, datasetType, level):
647  """Return a dict of supported keys and their value types for a given
648  dataset type at a given level of the key hierarchy.
649 
650  Parameters
651  ----------
652  datasetType : `str`
653  Dataset type or None for all dataset types.
654  level : `str` or None
655  Level or None for all levels or '' for the default level for the
656  camera.
657 
658  Returns
659  -------
660  `dict`
661  Keys are strings usable in a dataset identifier, values are their
662  value types.
663  """
664 
665  # not sure if this is how we want to do this. what if None was intended?
666  if level == '':
667  level = self.getDefaultLevel()
668 
669  if datasetType is None:
670  keyDict = copy.copy(self.keyDict)
671  else:
672  keyDict = self.mappings[datasetType].keys()
673  if level is not None and level in self.levels:
674  keyDict = copy.copy(keyDict)
675  for l in self.levels[level]:
676  if l in keyDict:
677  del keyDict[l]
678  return keyDict
679 

◆ getPackageDir()

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

Definition at line 707 of file cameraMapper.py.

707  def getPackageDir(cls):
708  """Return the base directory of this package"""
709  return getPackageDir(cls.getPackageName())
710 
std::string getPackageDir(std::string const &packageName)
return the root directory of a setup package
Definition: packaging.cc:33

◆ getPackageName()

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

Definition at line 700 of file cameraMapper.py.

700  def getPackageName(cls):
701  """Return the name of the package containing this CameraMapper."""
702  if cls.packageName is None:
703  raise ValueError('class variable packageName must not be None')
704  return cls.packageName
705 

◆ 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.

1192  def getRegistry(self):
1193  """Get the registry used by this mapper.
1194 
1195  Returns
1196  -------
1197  Registry or None
1198  The registry used by this mapper for this mapper's repository.
1199  """
1200  return self.registry
1201 

◆ 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 936 of file cameraMapper.py.

936  def getShortCcdName(ccdName):
937  """Convert a CCD name to a form useful as a filename
938 
939  The default implementation converts spaces to underscores.
940  """
941  return ccdName.replace(" ", "_")
942 

◆ 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 636 of file cameraMapper.py.

636  def keys(self):
637  """Return supported keys.
638 
639  Returns
640  -------
641  iterable
642  List of keys usable in a dataset identifier
643  """
644  return iter(self.keyDict.keys())
645 

◆ map()

def lsst.daf.persistence.mapper.Mapper.map (   self,
  datasetType,
  dataId,
  write = False 
)
inherited
Map a data id using the mapping method for its dataset type.

Parameters
----------
datasetType : string
    The datasetType to map
dataId : DataId instance
    The dataId to use when mapping
write : bool, optional
    Indicates if the map is being performed for a read operation
    (False) or a write operation (True)

Returns
-------
ButlerLocation or a list of ButlerLocation
    The location(s) found for the map operation. If write is True, a
    list is returned. If write is False a single ButlerLocation is
    returned.

Raises
------
NoResults
    If no locaiton was found for this map operation, the derived mapper
    class may raise a lsst.daf.persistence.NoResults exception. Butler
    catches this and will look in the next Repository if there is one.

Definition at line 138 of file mapper.py.

138  def map(self, datasetType, dataId, write=False):
139  """Map a data id using the mapping method for its dataset type.
140 
141  Parameters
142  ----------
143  datasetType : string
144  The datasetType to map
145  dataId : DataId instance
146  The dataId to use when mapping
147  write : bool, optional
148  Indicates if the map is being performed for a read operation
149  (False) or a write operation (True)
150 
151  Returns
152  -------
153  ButlerLocation or a list of ButlerLocation
154  The location(s) found for the map operation. If write is True, a
155  list is returned. If write is False a single ButlerLocation is
156  returned.
157 
158  Raises
159  ------
160  NoResults
161  If no locaiton was found for this map operation, the derived mapper
162  class may raise a lsst.daf.persistence.NoResults exception. Butler
163  catches this and will look in the next Repository if there is one.
164  """
165  func = getattr(self, 'map_' + datasetType)
166  return func(self.validate(dataId), write)
167 

◆ map_camera()

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

Definition at line 711 of file cameraMapper.py.

711  def map_camera(self, dataId, write=False):
712  """Map a camera dataset."""
713  if self.camera is None:
714  raise RuntimeError("No camera dataset available.")
715  actualId = self._transformId(dataId)
717  pythonType="lsst.afw.cameraGeom.CameraConfig",
718  cppType="Config",
719  storageName="ConfigStorage",
720  locationList=self.cameraDataLocation or "ignored",
721  dataId=actualId,
722  mapper=self,
723  storage=self.rootStorage
724  )
725 

◆ map_expIdInfo()

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

Definition at line 733 of file cameraMapper.py.

733  def map_expIdInfo(self, dataId, write=False):
735  pythonType="lsst.obs.base.ExposureIdInfo",
736  cppType=None,
737  storageName="Internal",
738  locationList="ignored",
739  dataId=dataId,
740  mapper=self,
741  storage=self.rootStorage
742  )
743 

◆ map_skypolicy()

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

Definition at line 766 of file cameraMapper.py.

766  def map_skypolicy(self, dataId):
767  """Map a sky policy."""
768  return dafPersist.ButlerLocation("lsst.pex.policy.Policy", "Policy",
769  "Internal", None, None, self,
770  storage=self.rootStorage)
771 

◆ queryMetadata()

def lsst.daf.persistence.mapper.Mapper.queryMetadata (   self,
  datasetType,
  format,
  dataId 
)
inherited
Get possible values for keys given a partial data id.

:param datasetType: see documentation about the use of datasetType
:param key: this is used as the 'level' parameter
:param format:
:param dataId: see documentation about the use of dataId
:return:

Definition at line 115 of file mapper.py.

115  def queryMetadata(self, datasetType, format, dataId):
116  """Get possible values for keys given a partial data id.
117 
118  :param datasetType: see documentation about the use of datasetType
119  :param key: this is used as the 'level' parameter
120  :param format:
121  :param dataId: see documentation about the use of dataId
122  :return:
123  """
124  func = getattr(self, 'query_' + datasetType)
125 
126  val = func(format, self.validate(dataId))
127  return val
128 

◆ standardize()

def lsst.daf.persistence.mapper.Mapper.standardize (   self,
  datasetType,
  item,
  dataId 
)
inherited
Standardize an object using the standardization method for its data
set type, if it exists.

Definition at line 174 of file mapper.py.

174  def standardize(self, datasetType, item, dataId):
175  """Standardize an object using the standardization method for its data
176  set type, if it exists."""
177 
178  if hasattr(self, 'std_' + datasetType):
179  func = getattr(self, 'std_' + datasetType)
180  return func(item, self.validate(dataId))
181  return item
182 

◆ 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 750 of file cameraMapper.py.

750  def std_bfKernel(self, item, dataId):
751  """Disable standardization for bfKernel
752 
753  bfKernel is a calibration product that is numpy array,
754  unlike other calibration products that are all images;
755  all calibration images are sent through _standardizeExposure
756  due to CalibrationMapping, but we don't want that to happen to bfKernel
757  """
758  return item
759 

◆ 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 760 of file cameraMapper.py.

760  def std_raw(self, item, dataId):
761  """Standardize a raw dataset by converting it to an Exposure instead
762  of an Image"""
763  return self._standardizeExposure(self.exposures['raw'], item, dataId,
764  trimmed=False, setVisitInfo=True)
765 

◆ 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 772 of file cameraMapper.py.

772  def std_skypolicy(self, item, dataId):
773  """Standardize a sky policy by returning the one we use."""
774  return self.skypolicy
775 

◆ validate()

def lsst.daf.persistence.mapper.Mapper.validate (   self,
  dataId 
)
inherited
Validate a dataId's contents.

If the dataId is valid, return it.  If an invalid component can be
transformed into a valid one, copy the dataId, fix the component, and
return the copy.  Otherwise, raise an exception.

Definition at line 183 of file mapper.py.

183  def validate(self, dataId):
184  """Validate a dataId's contents.
185 
186  If the dataId is valid, return it. If an invalid component can be
187  transformed into a valid one, copy the dataId, fix the component, and
188  return the copy. Otherwise, raise an exception."""
189 
190  return dataId
191 

Member Data Documentation

◆ calibRegistry

lsst.obs.base.cameraMapper.CameraMapper.calibRegistry

Definition at line 254 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.

◆ category

lsst.obs.base.cameraMapper.CameraMapper.category
static

Definition at line 960 of file cameraMapper.py.

◆ defaultLevel

lsst.obs.base.cameraMapper.CameraMapper.defaultLevel

Definition at line 213 of file cameraMapper.py.

◆ defaultSubLevels

lsst.obs.base.cameraMapper.CameraMapper.defaultSubLevels

Definition at line 214 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 208 of file cameraMapper.py.

◆ log

lsst.obs.base.cameraMapper.CameraMapper.log

Definition at line 194 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 180 of file cameraMapper.py.

◆ mappings

lsst.obs.base.cameraMapper.CameraMapper.mappings

Definition at line 334 of file cameraMapper.py.

◆ packageName

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

Definition at line 176 of file cameraMapper.py.

◆ PupilFactoryClass

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

Definition at line 183 of file cameraMapper.py.

◆ registry

lsst.obs.base.cameraMapper.CameraMapper.registry

Definition at line 246 of file cameraMapper.py.

◆ root

lsst.obs.base.cameraMapper.CameraMapper.root

Definition at line 197 of file cameraMapper.py.

◆ rootStorage

lsst.obs.base.cameraMapper.CameraMapper.rootStorage

Definition at line 223 of file cameraMapper.py.

◆ translatorClass

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

Definition at line 186 of file cameraMapper.py.


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