Coverage for python/lsst/obs/lsst/translators/lsstCamSim.py: 61%

23 statements  

« prev     ^ index     » next       coverage.py v7.5.0, created at 2024-04-24 04:06 -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. 

10 

11"""Metadata translation code for the Simulated LSST Camera""" 

12 

13__all__ = ("LsstCamSimTranslator",) 

14 

15import logging 

16 

17from .lsstCam import LsstCamTranslator 

18from .lsst import SIMONYI_TELESCOPE 

19 

20log = logging.getLogger(__name__) 

21 

22 

23class LsstCamSimTranslator(LsstCamTranslator): 

24 """Metadata translation for the simulated LSST Camera.""" 

25 

26 name = "LSSTCamSim" 

27 """Name of this translation class""" 

28 

29 _const_map = { 

30 "instrument": "LSSTCamSim", 

31 } 

32 

33 cameraPolicyFile = "policy/lsstCamSim.yaml" 

34 

35 @classmethod 

36 def can_translate(cls, header, filename=None): 

37 """Indicate whether this translation class can translate the 

38 supplied header. 

39 

40 Parameters 

41 ---------- 

42 header : `dict`-like 

43 Header to convert to standardized form. 

44 filename : `str`, optional 

45 Name of file being translated. 

46 

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 

58 

59 return False 

60 

61 @classmethod 

62 def fix_header(cls, header, instrument, obsid, filename=None): 

63 """Fix Simulated LSSTCamSim headers. 

64 

65 Notes 

66 ----- 

67 Content will be added as needed. 

68 

69 Corrections are reported as debug level log messages. 

70 

71 See `~astro_metadata_translator.fix_header` for details of the general 

72 process. 

73 """ 

74 modified = False 

75 

76 # Currently, no fixes are required. 

77 

78 return modified