Coverage for tests/test_decam.py: 60%

Shortcuts 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

14 statements  

1# This file is part of astro_metadata_translator. 

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 LICENSE file at the top-level directory of this distribution 

7# for details of code ownership. 

8# 

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

10# license that can be found in the LICENSE file. 

11 

12import os.path 

13import unittest 

14 

15import astropy.units as u 

16 

17from astro_metadata_translator.tests import MetadataAssertHelper 

18 

19TESTDIR = os.path.abspath(os.path.dirname(__file__)) 

20 

21 

22class DecamTestCase(unittest.TestCase, MetadataAssertHelper): 

23 datadir = os.path.join(TESTDIR, "data") 

24 

25 def test_decam_translator(self): 

26 test_data = ( 

27 ( 

28 "fitsheader-decam.yaml", 

29 dict( 

30 telescope="CTIO 4.0-m telescope", 

31 instrument="DECam", 

32 boresight_rotation_coord="sky", 

33 dark_time=201.15662 * u.s, 

34 detector_exposure_id=22938825, 

35 detector_name="1", 

36 detector_unique_name="S1", 

37 detector_group="S", 

38 detector_num=25, 

39 detector_serial="S3-111_107419-8-3", 

40 exposure_id=229388, 

41 exposure_group="229388", 

42 exposure_time=200.0 * u.s, 

43 group_counter_end=229388, 

44 group_counter_start=229388, 

45 has_simulated_content=False, 

46 object="DES supernova hex SN-S1 tiling 22", 

47 observation_counter=229388, 

48 observation_id="ct4m20130901t060255", 

49 observation_type="science", 

50 observation_reason="science", 

51 observing_day=20130901, 

52 physical_filter="z DECam SDSS c0004 9260.0 1520.0", 

53 pressure=779.0 * u.hPa, 

54 relative_humidity=23.0, 

55 science_program="2012B-0001", 

56 temperature=11.9 * u.deg_C, 

57 visit_id=229388, 

58 wcs_params=dict(max_sep=1.5), 

59 ), 

60 ), 

61 ( 

62 "fitsheader-decam-0160496.yaml", 

63 dict( 

64 telescope="CTIO 4.0-m telescope", 

65 instrument="DECam", 

66 boresight_rotation_coord="sky", 

67 boresight_rotation_angle=90 * u.degree, 

68 dark_time=0.0407898 * u.s, 

69 detector_exposure_id=16049625, 

70 detector_name="1", 

71 detector_unique_name="S1", 

72 detector_group="S", 

73 detector_num=25, 

74 detector_serial="S3-111_107419-8-3", 

75 exposure_id=160496, 

76 exposure_group="160496", 

77 exposure_time=0.0 * u.s, 

78 group_counter_end=160496, 

79 group_counter_start=160496, 

80 has_simulated_content=False, 

81 object="postflats-BIAS", 

82 observation_counter=160496, 

83 observation_id="ct4m20121211t220632", 

84 observation_type="zero", 

85 observation_reason="unknown", 

86 observing_day=20121211, 

87 physical_filter="solid plate 0.0 0.0", # corrected value 

88 pressure=777.0 * u.hPa, 

89 relative_humidity=38.0, 

90 science_program="2012B-0416", 

91 temperature=17.0 * u.deg_C, 

92 visit_id=160496, 

93 wcs_params=dict(max_sep=1.5), 

94 ), 

95 ), 

96 ( 

97 "fitsheader-decam-calexp-0412037_10.yaml", 

98 dict( 

99 telescope="CTIO 4.0-m telescope", 

100 instrument="DECam", 

101 boresight_rotation_coord="sky", 

102 boresight_rotation_angle=90 * u.degree, 

103 dark_time=87.1054702 * u.s, 

104 detector_exposure_id=41203701, 

105 detector_name="29", 

106 detector_unique_name="S29", 

107 detector_group="S", 

108 detector_num=1, 

109 detector_serial="S3-06_123195-15-3", 

110 exposure_id=412037, 

111 exposure_group="412037", 

112 exposure_time=86.0 * u.s, 

113 group_counter_end=412037, 

114 group_counter_start=412037, 

115 has_simulated_content=False, 

116 object="Blind15A_03", 

117 observation_counter=412037, 

118 observation_id="ct4m20150220t004721", 

119 observation_type="science", 

120 observation_reason="science", 

121 observing_day=20150220, 

122 physical_filter="g", 

123 pressure=777.0 * u.hPa, 

124 relative_humidity=76.0, 

125 science_program="2015A-0608", 

126 temperature=9.0 * u.deg_C, 

127 visit_id=412037, 

128 wcs_params=dict(max_sep=5.0), 

129 ), 

130 ), 

131 ( 

132 "fitsheader-decam-instcal-c4d_190402_050618_ooi_VR_v1.yaml", 

133 dict( 

134 telescope="CTIO 4.0-m telescope", 

135 instrument="DECam", 

136 boresight_rotation_coord="sky", 

137 boresight_rotation_angle=90 * u.degree, 

138 dark_time=120.7646399 * u.s, 

139 detector_exposure_id=84529101, 

140 detector_name="29", 

141 detector_unique_name="S29", 

142 detector_group="S", 

143 detector_num=1, 

144 detector_serial="S3-06_123195-15-3", 

145 exposure_id=845291, 

146 exposure_group="845291", 

147 exposure_time=120.0 * u.s, 

148 group_counter_end=845291, 

149 group_counter_start=845291, 

150 has_simulated_content=False, 

151 object="", 

152 observation_counter=845291, 

153 observation_id="ct4m20190402t050618", 

154 observation_type="science", 

155 observation_reason="science", 

156 observing_day=20190402, 

157 physical_filter="VR DECam c0007 6300.0 2600.0", 

158 pressure=779.0 * u.hPa, 

159 relative_humidity=38.0, 

160 science_program="2019A-0337", 

161 temperature=15.1 * u.deg_C, 

162 visit_id=845291, 

163 wcs_params=dict(max_sep=5.0), 

164 ), 

165 ), 

166 ) 

167 for file, expected in test_data: 

168 with self.subTest(f"Testing {file}"): 

169 self.assertObservationInfoFromYaml(file, dir=self.datadir, **expected) 

170 

171 

172if __name__ == "__main__": 172 ↛ 173line 172 didn't jump to line 173, because the condition on line 172 was never true

173 unittest.main()