Coverage for python / lsst / obs / lsst / translators / lsst_ucdcam.py: 70%

23 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-04-21 10:45 +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. 

10 

11"""Metadata translation code for LSST UC Davis Test Stand headers""" 

12 

13__all__ = ("LsstUCDCamTranslator", ) 

14 

15import logging 

16import astropy.units as u 

17from astropy.time import TimeDelta 

18 

19from .lsst import LsstBaseTranslator 

20 

21log = logging.getLogger(__name__) 

22 

23 

24LSST_UCDCAM = "LSST-UCDCam" 

25 

26 

27class LsstUCDCamTranslator(LsstBaseTranslator): 

28 """Metadata translator for LSST UC Davis Test Stand.""" 

29 

30 name = LSST_UCDCAM 

31 """Name of this translation class.""" 

32 

33 supported_instrument = LSST_UCDCAM 

34 """Supports the LSST-UCDCam instrument.""" 

35 

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 "can_see_sky": False, 

50 } 

51 

52 _trivial_map = { 

53 "detector_group": "RAFTBAY", 

54 "detector_name": "CCDSLOT", 

55 "observation_id": "OBSID", 

56 "detector_serial": "LSST_NUM", 

57 "exposure_time": ("EXPTIME", dict(unit=u.s)), 

58 "science_program": ("RUNNUM", dict(default="unknown")) 

59 } 

60 

61 cameraPolicyFile = "policy/ucd.yaml" 

62 

63 _ROLLOVER_TIME = TimeDelta(0, scale="tai", format="sec") 

64 """This instrument did not offset the observing day.""" 

65 

66 @classmethod 

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

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

69 supplied header. 

70 

71 Parameters 

72 ---------- 

73 header : `dict`-like 

74 Header to convert to standardized form. 

75 filename : `str`, optional 

76 Name of file being translated. 

77 

78 Returns 

79 ------- 

80 can : `bool` 

81 `True` if the header is recognized by this class. `False` 

82 otherwise. 

83 """ 

84 if "INSTRUME" in header: 

85 if header["INSTRUME"].lower() in (cls.supported_instrument.lower(), "LSST-UCDCam-ITL".lower()): 

86 return True 

87 return False