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