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

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
39 def __init__(self, **kwargs):
40 super().__init__(**kwargs)
41 packageDir = getPackageDir("obs_decam")
42 self.configPaths = [os.path.join(packageDir, "config")]
44 @classmethod
45 def getName(cls):
46 return "DECam"
48 def getCamera(self):
49 path = os.path.join(getPackageDir("obs_decam"), "decam", "camGeom")
50 config = CameraConfig()
51 config.load(os.path.join(path, "camera.py"))
52 return makeCameraFromPath(
53 cameraConfig=config,
54 ampInfoPath=path,
55 shortNameFunc=lambda name: name.replace(" ", "_"),
56 )
58 def register(self, registry):
59 camera = self.getCamera()
60 obsMax = 2**31
61 registry.insertDimensionData(
62 "instrument",
63 {"name": self.getName(), "detector_max": 64, "visit_max": obsMax, "exposure_max": obsMax}
64 )
66 for detector in camera:
67 registry.insertDimensionData(
68 "detector",
69 {
70 "instrument": self.getName(),
71 "id": detector.getId(),
72 "full_name": detector.getName(),
73 "name_in_raft": detector.getName()[1:],
74 "raft": detector.getName()[0],
75 "purpose": str(detector.getType()).split(".")[-1],
76 }
77 )
79 self._registerFilters(registry)
81 def getRawFormatter(self, dataId):
82 # local import to prevent circular dependency
83 from .rawFormatter import DarkEnergyCameraRawFormatter
84 return DarkEnergyCameraRawFormatter
86 def writeCuratedCalibrations(self, butler):
87 # TODO: DM-21016
88 pass