Coverage for tests/test_decam.py: 50%

14 statements  

« prev     ^ index     » next       coverage.py v7.3.1, created at 2023-09-20 10:39 +0000

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 """Test DECam translations.""" 

24 

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

26 

27 def test_decam_translator(self): 

28 test_data = ( 

29 ( 

30 "fitsheader-decam.yaml", 

31 dict( 

32 telescope="CTIO 4.0-m telescope", 

33 instrument="DECam", 

34 boresight_rotation_coord="sky", 

35 dark_time=201.15662 * u.s, 

36 detector_exposure_id=22938825, 

37 detector_name="1", 

38 detector_unique_name="S1", 

39 detector_group="S", 

40 detector_num=25, 

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

42 exposure_id=229388, 

43 exposure_group="229388", 

44 exposure_time=200.0 * u.s, 

45 focus_z=2497.32 * u.um, 

46 group_counter_end=229388, 

47 group_counter_start=229388, 

48 has_simulated_content=False, 

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

50 observation_counter=229388, 

51 observation_id="ct4m20130901t060255", 

52 observation_type="science", 

53 observation_reason="science", 

54 observing_day=20130901, 

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

56 pressure=779.0 * u.hPa, 

57 relative_humidity=23.0, 

58 science_program="2012B-0001", 

59 temperature=11.9 * u.deg_C, 

60 visit_id=229388, 

61 wcs_params=dict(max_sep=1.5), 

62 ), 

63 ), 

64 ( 

65 "fitsheader-decam-0160496.yaml", 

66 dict( 

67 telescope="CTIO 4.0-m telescope", 

68 instrument="DECam", 

69 boresight_rotation_coord="sky", 

70 boresight_rotation_angle=90 * u.degree, 

71 dark_time=0.0407898 * u.s, 

72 detector_exposure_id=16049625, 

73 detector_name="1", 

74 detector_unique_name="S1", 

75 detector_group="S", 

76 detector_num=25, 

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

78 exposure_id=160496, 

79 exposure_group="160496", 

80 exposure_time=0.0 * u.s, 

81 focus_z=0.0 * u.um, 

82 group_counter_end=160496, 

83 group_counter_start=160496, 

84 has_simulated_content=False, 

85 object="postflats-BIAS", 

86 observation_counter=160496, 

87 observation_id="ct4m20121211t220632", 

88 observation_type="zero", 

89 observation_reason="unknown", 

90 observing_day=20121211, 

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

92 pressure=777.0 * u.hPa, 

93 relative_humidity=38.0, 

94 science_program="2012B-0416", 

95 temperature=17.0 * u.deg_C, 

96 visit_id=160496, 

97 wcs_params=dict(max_sep=1.5), 

98 ), 

99 ), 

100 ( 

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

102 dict( 

103 telescope="CTIO 4.0-m telescope", 

104 instrument="DECam", 

105 boresight_rotation_coord="sky", 

106 boresight_rotation_angle=90 * u.degree, 

107 dark_time=87.1054702 * u.s, 

108 detector_exposure_id=41203701, 

109 detector_name="29", 

110 detector_unique_name="S29", 

111 detector_group="S", 

112 detector_num=1, 

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

114 exposure_id=412037, 

115 exposure_group="412037", 

116 exposure_time=86.0 * u.s, 

117 focus_z=2828.00 * u.um, 

118 group_counter_end=412037, 

119 group_counter_start=412037, 

120 has_simulated_content=False, 

121 object="Blind15A_03", 

122 observation_counter=412037, 

123 observation_id="ct4m20150220t004721", 

124 observation_type="science", 

125 observation_reason="science", 

126 observing_day=20150220, 

127 physical_filter="g", 

128 pressure=777.0 * u.hPa, 

129 relative_humidity=76.0, 

130 science_program="2015A-0608", 

131 temperature=9.0 * u.deg_C, 

132 visit_id=412037, 

133 wcs_params=dict(max_sep=5.0), 

134 ), 

135 ), 

136 ( 

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

138 dict( 

139 telescope="CTIO 4.0-m telescope", 

140 instrument="DECam", 

141 boresight_rotation_coord="sky", 

142 boresight_rotation_angle=90 * u.degree, 

143 dark_time=120.7646399 * u.s, 

144 detector_exposure_id=84529101, 

145 detector_name="29", 

146 detector_unique_name="S29", 

147 detector_group="S", 

148 detector_num=1, 

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

150 exposure_id=845291, 

151 exposure_group="845291", 

152 exposure_time=120.0 * u.s, 

153 focus_z=2174.28 * u.um, 

154 group_counter_end=845291, 

155 group_counter_start=845291, 

156 has_simulated_content=False, 

157 object="", 

158 observation_counter=845291, 

159 observation_id="ct4m20190402t050618", 

160 observation_type="science", 

161 observation_reason="science", 

162 observing_day=20190402, 

163 physical_filter="VR DECam c0007 6300.0 2600.0", 

164 pressure=779.0 * u.hPa, 

165 relative_humidity=38.0, 

166 science_program="2019A-0337", 

167 temperature=15.1 * u.deg_C, 

168 visit_id=845291, 

169 wcs_params=dict(max_sep=5.0), 

170 check_altaz=True, 

171 ), 

172 ), 

173 ) 

174 for file, expected in test_data: 

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

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

177 

178 

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

180 unittest.main()