Coverage for python/astro_metadata_translator/translators/subaru.py: 88%
18 statements
« prev ^ index » next coverage.py v7.4.4, created at 2024-03-20 11:09 +0000
« prev ^ index » next coverage.py v7.4.4, created at 2024-03-20 11:09 +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.
12"""Metadata translation code for Subaru telescope."""
14from __future__ import annotations
16__all__ = ("SubaruTranslator",)
18import astropy.time
19from astropy.coordinates import EarthLocation
21from ..translator import cache_translation
22from .fits import FitsTranslator
25class SubaruTranslator(FitsTranslator):
26 """Metadata translator for Subaru telescope headers."""
28 _observing_day_offset = astropy.time.TimeDelta(0, format="sec", scale="tai")
30 @cache_translation
31 def to_location(self) -> EarthLocation:
32 """Return the location of the Subaru telescope on Mauna Kea.
34 Hardcodes the location and does not look at any headers.
36 Returns
37 -------
38 location : `astropy.coordinates.EarthLocation`
39 An object representing the location of the telescope.
40 """
41 return EarthLocation.from_geodetic(-155.476667, 19.825556, 4139.0)
43 @cache_translation
44 def to_observation_counter(self) -> int:
45 """Return the lifetime exposure number.
47 Returns
48 -------
49 sequence : `int`
50 The observation counter.
51 """
52 return self.to_exposure_id()
54 @classmethod
55 def observing_date_to_offset(cls, observing_date: astropy.time.Time) -> astropy.time.TimeDelta | None:
56 """Return the offset to use when calculating the observing day.
58 Parameters
59 ----------
60 observing_date : `astropy.time.Time`
61 The date of the observation. Unused.
63 Returns
64 -------
65 offset : `astropy.time.TimeDelta`
66 The offset to apply. The offset is always 0 seconds. In Hawaii
67 UTC rollover is at 2pm local time.
68 """
69 return cls._observing_day_offset