LSSTApplications  19.0.0-10-g920eed2,19.0.0-11-g48a0200+2,19.0.0-18-gfc4e62b+13,19.0.0-2-g3b2f90d+2,19.0.0-2-gd671419+5,19.0.0-20-g5a5a17ab+11,19.0.0-21-g2644856+13,19.0.0-23-g84eeccb+1,19.0.0-24-g878c510+1,19.0.0-25-g6c8df7140,19.0.0-25-gb330496+1,19.0.0-3-g2b32d65+5,19.0.0-3-g8227491+12,19.0.0-3-g9c54d0d+12,19.0.0-3-gca68e65+8,19.0.0-3-gcfc5f51+5,19.0.0-3-ge110943+11,19.0.0-3-ge74d124,19.0.0-3-gfe04aa6+13,19.0.0-30-g9c3fd16+1,19.0.0-4-g06f5963+5,19.0.0-4-g3d16501+13,19.0.0-4-g4a9c019+5,19.0.0-4-g5a8b323,19.0.0-4-g66397f0+1,19.0.0-4-g8278b9b+1,19.0.0-4-g8557e14,19.0.0-4-g8964aba+13,19.0.0-4-ge404a01+12,19.0.0-5-g40f3a5a,19.0.0-5-g4db63b3,19.0.0-5-gfb03ce7+13,19.0.0-6-gbaebbfb+12,19.0.0-61-gec4c6e08+1,19.0.0-7-g039c0b5+11,19.0.0-7-gbea9075+4,19.0.0-7-gc567de5+13,19.0.0-71-g41c0270,19.0.0-9-g2f02add+1,19.0.0-9-g463f923+12,w.2020.22
LSSTDataManagementBasePackage
_instrument.py
Go to the documentation of this file.
1 # This file is part of obs_decam.
2 #
3 # Developed for the LSST Data Management System.
4 # This product includes software developed by the LSST Project
5 # (http://www.lsst.org).
6 # See the COPYRIGHT file at the top-level directory of this distribution
7 # for details of code ownership.
8 #
9 # This program is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
13 #
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 
22 """Butler instrument description for the Dark Energy Camera.
23 """
24 
25 __all__ = ("DarkEnergyCamera",)
26 
27 import os
28 
29 from lsst.afw.cameraGeom import makeCameraFromPath, CameraConfig
30 from lsst.obs.base import Instrument
31 from lsst.obs.base.gen2to3 import AbstractToPhysicalFilterKeyHandler, TranslatorFactory
32 from lsst.obs.decam.decamFilters import DECAM_FILTER_DEFINITIONS
33 
34 from lsst.daf.butler.core.utils import getFullTypeName
35 from lsst.utils import getPackageDir
36 
37 
39  filterDefinitions = DECAM_FILTER_DEFINITIONS
40  policyName = "decam"
41  obsDataPackage = "obs_decam_data"
42 
43  def __init__(self, **kwargs):
44  super().__init__(**kwargs)
45  packageDir = getPackageDir("obs_decam")
46  self.configPaths = [os.path.join(packageDir, "config")]
47 
48  @classmethod
49  def getName(cls):
50  return "DECam"
51 
52  def getCamera(self):
53  path = os.path.join(getPackageDir("obs_decam"), self.policyName, "camGeom")
54  config = CameraConfig()
55  config.load(os.path.join(path, "camera.py"))
56  return makeCameraFromPath(
57  cameraConfig=config,
58  ampInfoPath=path,
59  shortNameFunc=lambda name: name.replace(" ", "_"),
60  )
61 
62  def register(self, registry):
63  camera = self.getCamera()
64  obsMax = 2**31
65  registry.insertDimensionData(
66  "instrument",
67  {"name": self.getName(), "detector_max": 64, "visit_max": obsMax, "exposure_max": obsMax,
68  "class_name": getFullTypeName(self),
69  }
70  )
71 
72  for detector in camera:
73  registry.insertDimensionData(
74  "detector",
75  {
76  "instrument": self.getName(),
77  "id": detector.getId(),
78  "full_name": detector.getName(),
79  "name_in_raft": detector.getName()[1:],
80  "raft": detector.getName()[0],
81  "purpose": str(detector.getType()).split(".")[-1],
82  }
83  )
84 
85  self._registerFilters(registry)
86 
87  def getRawFormatter(self, dataId):
88  # local import to prevent circular dependency
89  from .rawFormatter import DarkEnergyCameraRawFormatter
90  return DarkEnergyCameraRawFormatter
91 
92  def makeDataIdTranslatorFactory(self) -> TranslatorFactory:
93  # Docstring inherited from lsst.obs.base.Instrument.
94  factory = TranslatorFactory()
95  factory.addGenericInstrumentRules(self.getName(), calibFilterType="abstract_filter",
96  detectorKey="ccdnum")
97  # DECam calibRegistry entries are abstract_filters, but we need physical_filter
98  # in the gen3 registry.
100  instrument=self.getName(),
101  gen2keys=("filter",),
102  consume=("filter",),
103  datasetTypeName="cpFlat")
104  return factory
lsst.obs.base._instrument.Instrument.getName
def getName(cls)
Definition: _instrument.py:96
lsst.obs.decam._instrument.DarkEnergyCamera.makeDataIdTranslatorFactory
TranslatorFactory makeDataIdTranslatorFactory(self)
Definition: _instrument.py:92
lsst.obs.base.gen2to3
Definition: __init__.py:1
lsst::afw::cameraGeom.cameraConfig.CameraConfig
Definition: cameraConfig.py:132
lsst.obs.decam.decamFilters
Definition: decamFilters.py:1
lsst.obs.decam._instrument.DarkEnergyCamera.getCamera
def getCamera(self)
Definition: _instrument.py:52
lsst.obs.base._instrument.Instrument._registerFilters
def _registerFilters(self, registry)
Definition: _instrument.py:197
lsst.obs.base._instrument.Instrument.getCamera
def getCamera(self)
Definition: _instrument.py:106
lsst.obs.decam._instrument.DarkEnergyCamera.filterDefinitions
filterDefinitions
Definition: _instrument.py:39
lsst::utils::getPackageDir
std::string getPackageDir(std::string const &packageName)
return the root directory of a setup package
Definition: packaging.cc:33
lsst.obs.decam._instrument.DarkEnergyCamera.getName
def getName(cls)
Definition: _instrument.py:49
lsst.obs.base._instrument.Instrument.policyName
policyName
Definition: _instrument.py:63
lsst.obs.decam._instrument.DarkEnergyCamera.__init__
def __init__(self, **kwargs)
Definition: _instrument.py:43
lsst.obs.base.gen2to3.translators.TranslatorFactory
Definition: translators.py:281
lsst.obs.decam._instrument.DarkEnergyCamera.register
def register(self, registry)
Definition: _instrument.py:62
lsst::utils
Definition: Backtrace.h:29
lsst.obs.base._instrument.Instrument
Definition: _instrument.py:49
lsst.obs.decam._instrument.DarkEnergyCamera
Definition: _instrument.py:38
lsst.obs.decam._instrument.DarkEnergyCamera.getRawFormatter
def getRawFormatter(self, dataId)
Definition: _instrument.py:87
lsst::afw::cameraGeom
Definition: Amplifier.h:33
lsst::afw::cameraGeom.cameraFactory.makeCameraFromPath
def makeCameraFromPath(cameraConfig, ampInfoPath, shortNameFunc, pupilFactoryClass=PupilFactory)
Definition: cameraFactory.py:122
lsst.obs.base._instrument.Instrument.configPaths
tuple configPaths
Definition: _instrument.py:56
lsst.obs.base.gen2to3.translators.AbstractToPhysicalFilterKeyHandler
Definition: translators.py:260
lsst.obs.base
Definition: __init__.py:1