Coverage for tests / test_visit_info.py: 60%
13 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-26 08:50 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-26 08:50 +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.units as u
17from astro_metadata_translator.tests import MetadataAssertHelper
18from astro_metadata_translator.translators import VisitInfoTranslator
20TESTDIR = os.path.abspath(os.path.dirname(__file__))
23class VisitInfoTestCase(unittest.TestCase, MetadataAssertHelper):
24 """Test VisitInfo translations."""
26 datadir = os.path.join(TESTDIR, "data")
28 def test_decam_translator(self) -> None:
29 test_data = (
30 (
31 "visit_info.yaml",
32 dict(
33 telescope="Simonyi Survey Telescope",
34 instrument="LSSTCam",
35 boresight_rotation_coord="sky",
36 dark_time=30.9427 * u.s,
37 detector_exposure_id=None,
38 detector_name=None,
39 detector_unique_name=None,
40 detector_group=None,
41 detector_num=85,
42 detector_serial=None,
43 exposure_id=2025052000177,
44 exposure_group="2025052000177",
45 exposure_time=30.0011086463928 * u.s,
46 exposure_time_requested=30.0011086463928 * u.s,
47 focus_z=-1.8695301477484 * u.mm,
48 group_counter_end=2025052000177,
49 group_counter_start=2025052000177,
50 has_simulated_content=False,
51 object="COSMOS",
52 observation_counter=2025052000177,
53 observation_id="2025052000177",
54 observation_type="science",
55 observation_reason="field_survey_science",
56 observing_day=20250521,
57 physical_filter=None,
58 pressure=74510.0 * u.Pa,
59 relative_humidity=21.3250007629395,
60 science_program="BLOCK-365",
61 temperature=12.1499996185303 * u.deg_C,
62 visit_id=2025052000177,
63 wcs_params=dict(max_sep=3.5),
64 ),
65 ),
66 )
67 for file, expected in test_data:
68 with self.subTest(f"Testing {file}"):
69 self.assertObservationInfoFromYaml(
70 file, dir=self.datadir, translator_class=VisitInfoTranslator, **expected
71 )
74if __name__ == "__main__":
75 unittest.main()