Coverage for tests/test_decam.py : 56%

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