Hide keyboard shortcuts

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

21 

22"""Butler instrument description for the Dark Energy Camera. 

23""" 

24 

25__all__ = ("DarkEnergyCamera",) 

26 

27import os 

28 

29from lsst.afw.cameraGeom import makeCameraFromPath, CameraConfig 

30from lsst.obs.base import Instrument 

31from lsst.obs.decam.decamFilters import DECAM_FILTER_DEFINITIONS 

32 

33from lsst.daf.butler.core.utils import getFullTypeName 

34from lsst.utils import getPackageDir 

35 

36 

37class DarkEnergyCamera(Instrument): 

38 filterDefinitions = DECAM_FILTER_DEFINITIONS 

39 policyName = "decam" 

40 obsDataPackage = "obs_decam_data" 

41 

42 def __init__(self, **kwargs): 

43 super().__init__(**kwargs) 

44 packageDir = getPackageDir("obs_decam") 

45 self.configPaths = [os.path.join(packageDir, "config")] 

46 

47 @classmethod 

48 def getName(cls): 

49 return "DECam" 

50 

51 def getCamera(self): 

52 path = os.path.join(getPackageDir("obs_decam"), self.policyName, "camGeom") 

53 config = CameraConfig() 

54 config.load(os.path.join(path, "camera.py")) 

55 return makeCameraFromPath( 

56 cameraConfig=config, 

57 ampInfoPath=path, 

58 shortNameFunc=lambda name: name.replace(" ", "_"), 

59 ) 

60 

61 def register(self, registry): 

62 camera = self.getCamera() 

63 obsMax = 2**31 

64 registry.insertDimensionData( 

65 "instrument", 

66 {"name": self.getName(), "detector_max": 64, "visit_max": obsMax, "exposure_max": obsMax, 

67 "class_name": getFullTypeName(self), 

68 } 

69 ) 

70 

71 for detector in camera: 

72 registry.insertDimensionData( 

73 "detector", 

74 { 

75 "instrument": self.getName(), 

76 "id": detector.getId(), 

77 "full_name": detector.getName(), 

78 "name_in_raft": detector.getName()[1:], 

79 "raft": detector.getName()[0], 

80 "purpose": str(detector.getType()).split(".")[-1], 

81 } 

82 ) 

83 

84 self._registerFilters(registry) 

85 

86 def getRawFormatter(self, dataId): 

87 # local import to prevent circular dependency 

88 from .rawFormatter import DarkEnergyCameraRawFormatter 

89 return DarkEnergyCameraRawFormatter