Coverage for python/lsst/obs/decam/instrument.py : 44%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
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/>.
22"""Butler instrument description for the Dark Energy Camera.
23"""
25__all__ = ("DarkEnergyCamera",)
27import os
29from lsst.afw.cameraGeom import makeCameraFromPath, CameraConfig
30from lsst.obs.base import Instrument
31from lsst.obs.decam.decamFilters import DECAM_FILTER_DEFINITIONS
33from lsst.utils import getPackageDir
36class DarkEnergyCamera(Instrument):
37 filterDefinitions = DECAM_FILTER_DEFINITIONS
38 policyName = "decam"
39 obsDataPackage = "obs_decam_data"
41 def __init__(self, **kwargs):
42 super().__init__(**kwargs)
43 packageDir = getPackageDir("obs_decam")
44 self.configPaths = [os.path.join(packageDir, "config")]
46 @classmethod
47 def getName(cls):
48 return "DECam"
50 def getCamera(self):
51 path = os.path.join(getPackageDir("obs_decam"), self.policyName, "camGeom")
52 config = CameraConfig()
53 config.load(os.path.join(path, "camera.py"))
54 return makeCameraFromPath(
55 cameraConfig=config,
56 ampInfoPath=path,
57 shortNameFunc=lambda name: name.replace(" ", "_"),
58 )
60 def register(self, registry):
61 camera = self.getCamera()
62 obsMax = 2**31
63 registry.insertDimensionData(
64 "instrument",
65 {"name": self.getName(), "detector_max": 64, "visit_max": obsMax, "exposure_max": obsMax}
66 )
68 for detector in camera:
69 registry.insertDimensionData(
70 "detector",
71 {
72 "instrument": self.getName(),
73 "id": detector.getId(),
74 "full_name": detector.getName(),
75 "name_in_raft": detector.getName()[1:],
76 "raft": detector.getName()[0],
77 "purpose": str(detector.getType()).split(".")[-1],
78 }
79 )
81 self._registerFilters(registry)
83 def getRawFormatter(self, dataId):
84 # local import to prevent circular dependency
85 from .rawFormatter import DarkEnergyCameraRawFormatter
86 return DarkEnergyCameraRawFormatter