Coverage for python/lsst/obs/lsst/translators/lsstCamSim.py: 61%
23 statements
« prev ^ index » next coverage.py v7.5.0, created at 2024-04-26 04:02 -0700
« prev ^ index » next coverage.py v7.5.0, created at 2024-04-26 04:02 -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 the Simulated LSST Camera"""
13__all__ = ("LsstCamSimTranslator",)
15import logging
17from .lsstCam import LsstCamTranslator
18from .lsst import SIMONYI_TELESCOPE
20log = logging.getLogger(__name__)
23class LsstCamSimTranslator(LsstCamTranslator):
24 """Metadata translation for the simulated LSST Camera."""
26 name = "LSSTCamSim"
27 """Name of this translation class"""
29 _const_map = {
30 "instrument": "LSSTCamSim",
31 }
33 cameraPolicyFile = "policy/lsstCamSim.yaml"
35 @classmethod
36 def can_translate(cls, header, filename=None):
37 """Indicate whether this translation class can translate the
38 supplied header.
40 Parameters
41 ----------
42 header : `dict`-like
43 Header to convert to standardized form.
44 filename : `str`, optional
45 Name of file being translated.
47 Returns
48 -------
49 can : `bool`
50 `True` if the header is recognized by this class. `False`
51 otherwise.
52 """
53 if "INSTRUME" in header and "TELESCOP" in header:
54 telescope = header["TELESCOP"]
55 instrument = header["INSTRUME"].lower()
56 if instrument == "lsstcamsim" and telescope in (SIMONYI_TELESCOPE, "LSST"):
57 return True
59 return False
61 @classmethod
62 def fix_header(cls, header, instrument, obsid, filename=None):
63 """Fix Simulated LSSTCamSim headers.
65 Notes
66 -----
67 Content will be added as needed.
69 Corrections are reported as debug level log messages.
71 See `~astro_metadata_translator.fix_header` for details of the general
72 process.
73 """
74 modified = False
76 # Currently, no fixes are required.
78 return modified