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