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

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

# This file is currently part of obs_lsst but is written to allow it 

# to be migrated to the astro_metadata_translator package at a later date. 

# 

# This product includes software developed by the LSST Project 

# (http://www.lsst.org). 

# See the LICENSE file in this directory for details of code ownership. 

# 

# Use of this source code is governed by a 3-clause BSD-style 

# license that can be found in the LICENSE file. 

 

"""Metadata translation code for the LSST Commissioning Camera""" 

 

__all__ = ("LsstComCamTranslator", ) 

 

import logging 

 

from .lsstCam import LsstCamTranslator 

 

log = logging.getLogger(__name__) 

 

DETECTOR_SERIALS = { 

"S00": "ITL-3800C-229", 

"S01": "ITL-3800C-251", 

"S02": "ITL-3800C-215", 

"S10": "ITL-3800C-326", 

"S11": "ITL-3800C-283", 

"S12": "ITL-3800C-243", 

"S20": "ITL-3800C-319", 

"S21": "ITL-3800C-209", 

"S22": "ITL-3800C-206", 

} 

 

 

class LsstComCamTranslator(LsstCamTranslator): 

"""Metadata translation for the LSST Commissioning Camera.""" 

 

name = "LSST-ComCam" 

"""Name of this translation class""" 

 

_const_map = { 

"instrument": "comCam", 

} 

 

# Use the comCam raft definition 

cameraPolicyFile = "policy/comCam.yaml" 

 

@classmethod 

def can_translate(cls, header, filename=None): 

"""Indicate whether this translation class can translate the 

supplied header. 

 

Looks for "COMCAM" instrument in case-insensitive manner but 

must be on LSST telescope. This avoids confusion with other 

telescopes using commissioning cameras. 

 

Parameters 

---------- 

header : `dict`-like 

Header to convert to standardized form. 

filename : `str`, optional 

Name of file being translated. 

 

Returns 

------- 

can : `bool` 

`True` if the header is recognized by this class. `False` 

otherwise. 

""" 

if "INSTRUME" in header and "TELESCOP" in header: 

telescope = header["TELESCOP"] 

instrument = header["INSTRUME"].lower() 

if instrument == "comcam" and telescope == "LSST": 

return True 

telcode = header.get("TELCODE", None) 

# Some lab data reports that it is LSST_CAMERA 

if telcode == "CC" and telescope == "LSST": 

return True 

 

return False 

 

@classmethod 

def fix_header(cls, header): 

"""Fix ComCam headers. 

 

Notes 

----- 

Fixes the following issues: 

 

* If LSST_NUM is missing it is filled in by looking at the CCDSLOT 

value and assuming that the ComCam detectors are fixed. 

 

Corrections are reported as debug level log messages. 

""" 

modified = False 

 

obsid = header.get("OBSID", "unknown") 

 

if "LSST_NUM" not in header: 

slot = header.get("CCDSLOT", None) 

if slot in DETECTOR_SERIALS: 

header["LSST_NUM"] = DETECTOR_SERIALS[slot] 

modified = True 

log.debug("%s: Set LSST_NUM to %s", obsid, header["LSST_NUM"]) 

 

return modified