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