Coverage for python/lsst/obs/lsst/translators/lsst_ucdcam.py: 70%
21 statements
« prev ^ index » next coverage.py v7.4.3, created at 2024-02-25 09:36 +0000
« prev ^ index » next coverage.py v7.4.3, created at 2024-02-25 09:36 +0000
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
18from .lsst import LsstBaseTranslator
20log = logging.getLogger(__name__)
23LSST_UCDCAM = "LSST-UCDCam"
26class LsstUCDCamTranslator(LsstBaseTranslator):
27 """Metadata translator for LSST UC Davis Test Stand."""
29 name = LSST_UCDCAM
30 """Name of this translation class."""
32 supported_instrument = LSST_UCDCAM
33 """Supports the LSST-UCDCam instrument."""
35 _const_map = {
36 "instrument": LSST_UCDCAM,
37 "telescope": None,
38 "location": None,
39 "boresight_rotation_coord": None,
40 "boresight_rotation_angle": None,
41 "boresight_airmass": None,
42 "tracking_radec": None,
43 "altaz_begin": None,
44 "object": "UNKNOWN",
45 "relative_humidity": None,
46 "temperature": None,
47 "pressure": None,
48 }
50 _trivial_map = {
51 "detector_group": "RAFTBAY",
52 "detector_name": "CCDSLOT",
53 "observation_id": "OBSID",
54 "detector_serial": "LSST_NUM",
55 "exposure_time": ("EXPTIME", dict(unit=u.s)),
56 "science_program": ("RUNNUM", dict(default="unknown"))
57 }
59 cameraPolicyFile = "policy/ucd.yaml"
61 @classmethod
62 def can_translate(cls, header, filename=None):
63 """Indicate whether this translation class can translate the
64 supplied header.
66 Parameters
67 ----------
68 header : `dict`-like
69 Header to convert to standardized form.
70 filename : `str`, optional
71 Name of file being translated.
73 Returns
74 -------
75 can : `bool`
76 `True` if the header is recognized by this class. `False`
77 otherwise.
78 """
79 if "INSTRUME" in header:
80 if header["INSTRUME"].lower() in (cls.supported_instrument.lower(), "LSST-UCDCam-ITL".lower()):
81 return True
82 return False