Coverage for python/lsst/obs/lsst/translators/lsst_ucdcam.py: 73%
24 statements
« prev ^ index » next coverage.py v7.4.4, created at 2024-04-19 05:25 -0700
« prev ^ index » next coverage.py v7.4.4, created at 2024-04-19 05:25 -0700
1# This file is currently part of obs_lsst but is written to allow it
2# to be migrated to the astro_metadata_translator package at a later date.
3#
4# This product includes software developed by the LSST Project
5# (http://www.lsst.org).
6# See the LICENSE file in this directory for details of code ownership.
7#
8# Use of this source code is governed by a 3-clause BSD-style
9# license that can be found in the LICENSE file.
11"""Metadata translation code for LSST UC Davis Test Stand headers"""
13__all__ = ("LsstUCDCamTranslator", )
15import logging
16import astropy.units as u
17from astropy.time import TimeDelta
19from .lsst import LsstBaseTranslator
21log = logging.getLogger(__name__)
24LSST_UCDCAM = "LSST-UCDCam"
27class LsstUCDCamTranslator(LsstBaseTranslator):
28 """Metadata translator for LSST UC Davis Test Stand."""
30 name = LSST_UCDCAM
31 """Name of this translation class."""
33 supported_instrument = LSST_UCDCAM
34 """Supports the LSST-UCDCam instrument."""
36 _const_map = {
37 "instrument": LSST_UCDCAM,
38 "telescope": None,
39 "location": None,
40 "boresight_rotation_coord": None,
41 "boresight_rotation_angle": None,
42 "boresight_airmass": None,
43 "tracking_radec": None,
44 "altaz_begin": None,
45 "object": "UNKNOWN",
46 "relative_humidity": None,
47 "temperature": None,
48 "pressure": None,
49 }
51 _trivial_map = {
52 "detector_group": "RAFTBAY",
53 "detector_name": "CCDSLOT",
54 "observation_id": "OBSID",
55 "detector_serial": "LSST_NUM",
56 "exposure_time": ("EXPTIME", dict(unit=u.s)),
57 "science_program": ("RUNNUM", dict(default="unknown"))
58 }
60 cameraPolicyFile = "policy/ucd.yaml"
62 _ROLLOVER_TIME = TimeDelta(0, scale="tai", format="sec")
63 """This instrument did not offset the observing day."""
65 @classmethod
66 def can_translate(cls, header, filename=None):
67 """Indicate whether this translation class can translate the
68 supplied header.
70 Parameters
71 ----------
72 header : `dict`-like
73 Header to convert to standardized form.
74 filename : `str`, optional
75 Name of file being translated.
77 Returns
78 -------
79 can : `bool`
80 `True` if the header is recognized by this class. `False`
81 otherwise.
82 """
83 if "INSTRUME" in header:
84 if header["INSTRUME"].lower() in (cls.supported_instrument.lower(), "LSST-UCDCam-ITL".lower()):
85 return True
86 return False