Coverage for tests/test_decam.py: 52%
15 statements
« prev ^ index » next coverage.py v7.4.4, created at 2024-03-20 11:09 +0000
« prev ^ index » next coverage.py v7.4.4, created at 2024-03-20 11:09 +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.
12import os.path
13import unittest
15import astropy.time
16import astropy.units as u
18from astro_metadata_translator.tests import MetadataAssertHelper
20TESTDIR = os.path.abspath(os.path.dirname(__file__))
23class DecamTestCase(unittest.TestCase, MetadataAssertHelper):
24 """Test DECam translations."""
26 datadir = os.path.join(TESTDIR, "data")
28 def test_decam_translator(self):
29 test_data = (
30 (
31 "fitsheader-decam.yaml",
32 dict(
33 telescope="CTIO 4.0-m telescope",
34 instrument="DECam",
35 boresight_rotation_coord="sky",
36 dark_time=201.15662 * u.s,
37 detector_exposure_id=22938825,
38 detector_name="1",
39 detector_unique_name="S1",
40 detector_group="S",
41 detector_num=25,
42 detector_serial="S3-111_107419-8-3",
43 exposure_id=229388,
44 exposure_group="229388",
45 exposure_time=200.0 * u.s,
46 focus_z=2497.32 * u.um,
47 group_counter_end=229388,
48 group_counter_start=229388,
49 has_simulated_content=False,
50 object="DES supernova hex SN-S1 tiling 22",
51 observation_counter=229388,
52 observation_id="ct4m20130901t060255",
53 observation_type="science",
54 observation_reason="science",
55 observing_day=20130831,
56 physical_filter="z DECam SDSS c0004 9260.0 1520.0",
57 pressure=779.0 * u.hPa,
58 relative_humidity=23.0,
59 science_program="2012B-0001",
60 temperature=11.9 * u.deg_C,
61 visit_id=229388,
62 wcs_params=dict(max_sep=1.5),
63 ),
64 ),
65 (
66 "fitsheader-decam-0160496.yaml",
67 dict(
68 telescope="CTIO 4.0-m telescope",
69 instrument="DECam",
70 boresight_rotation_coord="sky",
71 boresight_rotation_angle=90 * u.degree,
72 dark_time=0.0407898 * u.s,
73 detector_exposure_id=16049625,
74 detector_name="1",
75 detector_unique_name="S1",
76 detector_group="S",
77 detector_num=25,
78 detector_serial="S3-111_107419-8-3",
79 exposure_id=160496,
80 exposure_group="160496",
81 exposure_time=0.0 * u.s,
82 focus_z=0.0 * u.um,
83 group_counter_end=160496,
84 group_counter_start=160496,
85 has_simulated_content=False,
86 object="postflats-BIAS",
87 observation_counter=160496,
88 observation_id="ct4m20121211t220632",
89 observation_type="zero",
90 observation_reason="unknown",
91 observing_day=20121211,
92 observing_day_offset=astropy.time.TimeDelta(12 * 3600, format="sec", scale="tai"),
93 physical_filter="solid plate 0.0 0.0", # corrected value
94 pressure=777.0 * u.hPa,
95 relative_humidity=38.0,
96 science_program="2012B-0416",
97 temperature=17.0 * u.deg_C,
98 visit_id=160496,
99 wcs_params=dict(max_sep=1.5),
100 ),
101 ),
102 (
103 "fitsheader-decam-calexp-0412037_10.yaml",
104 dict(
105 telescope="CTIO 4.0-m telescope",
106 instrument="DECam",
107 boresight_rotation_coord="sky",
108 boresight_rotation_angle=90 * u.degree,
109 dark_time=87.1054702 * u.s,
110 detector_exposure_id=41203701,
111 detector_name="29",
112 detector_unique_name="S29",
113 detector_group="S",
114 detector_num=1,
115 detector_serial="S3-06_123195-15-3",
116 exposure_id=412037,
117 exposure_group="412037",
118 exposure_time=86.0 * u.s,
119 focus_z=2828.00 * u.um,
120 group_counter_end=412037,
121 group_counter_start=412037,
122 has_simulated_content=False,
123 object="Blind15A_03",
124 observation_counter=412037,
125 observation_id="ct4m20150220t004721",
126 observation_type="science",
127 observation_reason="science",
128 observing_day=20150219,
129 physical_filter="g",
130 pressure=777.0 * u.hPa,
131 relative_humidity=76.0,
132 science_program="2015A-0608",
133 temperature=9.0 * u.deg_C,
134 visit_id=412037,
135 wcs_params=dict(max_sep=5.0),
136 ),
137 ),
138 (
139 "fitsheader-decam-instcal-c4d_190402_050618_ooi_VR_v1.yaml",
140 dict(
141 telescope="CTIO 4.0-m telescope",
142 instrument="DECam",
143 boresight_rotation_coord="sky",
144 boresight_rotation_angle=90 * u.degree,
145 dark_time=120.7646399 * u.s,
146 detector_exposure_id=84529101,
147 detector_name="29",
148 detector_unique_name="S29",
149 detector_group="S",
150 detector_num=1,
151 detector_serial="S3-06_123195-15-3",
152 exposure_id=845291,
153 exposure_group="845291",
154 exposure_time=120.0 * u.s,
155 focus_z=2174.28 * u.um,
156 group_counter_end=845291,
157 group_counter_start=845291,
158 has_simulated_content=False,
159 object="",
160 observation_counter=845291,
161 observation_id="ct4m20190402t050618",
162 observation_type="science",
163 observation_reason="science",
164 observing_day=20190401,
165 physical_filter="VR DECam c0007 6300.0 2600.0",
166 pressure=779.0 * u.hPa,
167 relative_humidity=38.0,
168 science_program="2019A-0337",
169 temperature=15.1 * u.deg_C,
170 visit_id=845291,
171 wcs_params=dict(max_sep=5.0),
172 check_altaz=True,
173 ),
174 ),
175 )
176 for file, expected in test_data:
177 with self.subTest(f"Testing {file}"):
178 self.assertObservationInfoFromYaml(file, dir=self.datadir, **expected)
181if __name__ == "__main__": 181 ↛ 182line 181 didn't jump to line 182, because the condition on line 181 was never true
182 unittest.main()