Coverage for python/lsst/obs/lsst/translators/lsstCamSim.py: 57%
26 statements
« prev ^ index » next coverage.py v7.6.12, created at 2025-03-07 01:32 -0800
« prev ^ index » next coverage.py v7.6.12, created at 2025-03-07 01:32 -0800
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 the Simulated LSST Camera"""
13__all__ = ("LsstCamSimTranslator",)
15import logging
16import astropy
18from .lsstCam import LsstCamTranslator
19from .lsst import SIMONYI_TELESCOPE
21log = logging.getLogger(__name__)
24class LsstCamSimTranslator(LsstCamTranslator):
25 """Metadata translation for the simulated LSST Camera."""
27 name = "LSSTCamSim"
28 """Name of this translation class"""
30 _const_map = {
31 "instrument": "LSSTCamSim",
32 "has_simulated_content": True,
33 }
35 cameraPolicyFile = "policy/lsstCamSim.yaml"
37 @classmethod
38 def can_translate(cls, header, filename=None):
39 """Indicate whether this translation class can translate the
40 supplied header.
42 Parameters
43 ----------
44 header : `dict`-like
45 Header to convert to standardized form.
46 filename : `str`, optional
47 Name of file being translated.
49 Returns
50 -------
51 can : `bool`
52 `True` if the header is recognized by this class. `False`
53 otherwise.
54 """
55 if "INSTRUME" in header and "TELESCOP" in header:
56 telescope = header["TELESCOP"]
57 instrument = header["INSTRUME"].lower()
58 if instrument == "lsstcamsim" and telescope in (SIMONYI_TELESCOPE, "LSST"):
59 return True
61 return False
63 @classmethod
64 def fix_header(cls, header, instrument, obsid, filename=None):
65 """Fix Simulated LSSTCamSim headers.
67 Notes
68 -----
69 Content will be added as needed.
71 Corrections are reported as debug level log messages.
73 See `~astro_metadata_translator.fix_header` for details of the general
74 process.
75 """
76 modified = False
78 # Currently, no fixes are required.
80 return modified
82 @classmethod
83 def observing_date_to_offset(cls, observing_date: astropy.time.Time) -> astropy.time.TimeDelta | None:
84 # Always use the 12 hour offset.
85 return cls._ROLLOVER_TIME