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

14import astropy.units as u 

15 

16from astro_metadata_translator.tests import MetadataAssertHelper 

17 

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

19 

20 

21class DecamTestCase(unittest.TestCase, MetadataAssertHelper): 

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

23 

24 def test_decam_translator(self): 

25 test_data = (("fitsheader-decam.yaml", 

26 dict(telescope="CTIO 4.0-m telescope", 

27 instrument="DECam", 

28 boresight_rotation_coord="sky", 

29 dark_time=201.15662*u.s, 

30 detector_exposure_id=22938825, 

31 detector_name="1", 

32 detector_unique_name="S1", 

33 detector_group="S", 

34 detector_num=25, 

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

36 exposure_id=229388, 

37 exposure_group="229388", 

38 exposure_time=200.0*u.s, 

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

40 observation_id="ct4m20130901t060255", 

41 observation_type="science", 

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

43 pressure=779.0*u.hPa, 

44 relative_humidity=23.0, 

45 science_program="2012B-0001", 

46 temperature=11.9*u.deg_C, 

47 visit_id=229388, 

48 wcs_params=dict(max_sep=1.5))), 

49 ("fitsheader-decam-0160496.yaml", 

50 dict(telescope="CTIO 4.0-m telescope", 

51 instrument="DECam", 

52 boresight_rotation_coord="sky", 

53 boresight_rotation_angle=90*u.degree, 

54 dark_time=0.0407898*u.s, 

55 detector_exposure_id=None, 

56 detector_name="1", 

57 detector_unique_name="S1", 

58 detector_group="S", 

59 detector_num=25, 

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

61 exposure_id=None, 

62 exposure_group=None, 

63 exposure_time=0.0*u.s, 

64 object="postflats-BIAS", 

65 observation_id="ct4m20121211t220632", 

66 observation_type="zero", 

67 physical_filter="Y DECam c0005 10095.0 1130.0", 

68 pressure=777.0*u.hPa, 

69 relative_humidity=38.0, 

70 science_program="2012B-0416", 

71 temperature=17.0*u.deg_C, 

72 visit_id=None, 

73 wcs_params=dict(max_sep=1.5))), 

74 ("fitsheader-decam-calexp-0412037_10.yaml", 

75 dict(telescope="CTIO 4.0-m telescope", 

76 instrument="DECam", 

77 boresight_rotation_coord="sky", 

78 boresight_rotation_angle=90*u.degree, 

79 dark_time=87.1054702*u.s, 

80 detector_exposure_id=41203701, 

81 detector_name="29", 

82 detector_unique_name="S29", 

83 detector_group="S", 

84 detector_num=1, 

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

86 exposure_id=412037, 

87 exposure_group="412037", 

88 exposure_time=86.0*u.s, 

89 object="Blind15A_03", 

90 observation_id="ct4m20150220t004721", 

91 observation_type="science", 

92 physical_filter="g", 

93 pressure=777.0*u.hPa, 

94 relative_humidity=76.0, 

95 science_program="2015A-0608", 

96 temperature=9.0*u.deg_C, 

97 visit_id=412037, 

98 wcs_params=dict(max_sep=5.0))), 

99 ("fitsheader-decam-instcal-c4d_190402_050618_ooi_VR_v1.yaml", 

100 dict(telescope="CTIO 4.0-m telescope", 

101 instrument="DECam", 

102 boresight_rotation_coord="sky", 

103 boresight_rotation_angle=90*u.degree, 

104 dark_time=120.7646399*u.s, 

105 detector_exposure_id=84529101, 

106 detector_name="29", 

107 detector_unique_name="S29", 

108 detector_group="S", 

109 detector_num=1, 

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

111 exposure_id=845291, 

112 exposure_group="845291", 

113 exposure_time=120.0*u.s, 

114 object="", 

115 observation_id="ct4m20190402t050618", 

116 observation_type="science", 

117 physical_filter="VR DECam c0007 6300.0 2600.0", 

118 pressure=779.0*u.hPa, 

119 relative_humidity=38.0, 

120 science_program="2019A-0337", 

121 temperature=15.1*u.deg_C, 

122 visit_id=845291, 

123 wcs_params=dict(max_sep=5.0))), 

124 ) 

125 for file, expected in test_data: 

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

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

128 

129 

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

131 unittest.main()