Coverage for tests / test_sdss.py: 57%

12 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-04-14 23:38 +0000

1# This file is part of astro_metadata_translator. 

2# 

3# Developed for the LSST Data Management System. 

4# This product includes software developed by the LSST Project 

5# (http://www.lsst.org). 

6# See the LICENSE file at the top-level directory of this distribution 

7# for details of code ownership. 

8# 

9# Use of this source code is governed by a 3-clause BSD-style 

10# license that can be found in the LICENSE file. 

11 

12import os.path 

13import unittest 

14 

15import astropy.units as u 

16 

17from astro_metadata_translator.tests import MetadataAssertHelper 

18 

19TESTDIR = os.path.abspath(os.path.dirname(__file__)) 

20 

21 

22class SdssTestCase(unittest.TestCase, MetadataAssertHelper): 

23 """Test SDSS translations.""" 

24 

25 datadir = os.path.join(TESTDIR, "data") 

26 

27 def test_sdss_translator(self) -> None: 

28 test_data = ( 

29 ( 

30 "fitsheader-sdss-fpC-006377-g4-0399.yaml", 

31 dict( 

32 telescope="SDSS 2.5m", 

33 instrument="Imager on SDSS 2.5m", 

34 boresight_rotation_coord="sky", 

35 dark_time=0.0 * u.s, 

36 detector_exposure_id=6377140399, 

37 detector_name="54", 

38 detector_unique_name="g4", 

39 detector_group="4", 

40 detector_num=15, 

41 detector_serial="UNKNOWN", 

42 exposure_id=6377, 

43 exposure_group="6377", 

44 exposure_time=53.907456 * u.s, 

45 exposure_time_requested=53.907456 * u.s, 

46 group_counter_end=0, 

47 group_counter_start=0, 

48 has_simulated_content=False, 

49 object="82 S", 

50 observation_counter=0, 

51 observation_id="6377 4 g 407", 

52 observation_type="science", 

53 observation_reason="science", 

54 observing_day=20060920, 

55 observing_day_offset=None, 

56 physical_filter="g", 

57 pressure=None, 

58 relative_humidity=None, 

59 science_program="82 S", 

60 temperature=None, 

61 visit_id=6377, 

62 wcs_params=dict(max_sep=10.0), 

63 ), 

64 ), 

65 ) 

66 for file, expected in test_data: 

67 with self.subTest(f"Testing {file}"): 

68 self.assertObservationInfoFromYaml(file, dir=self.datadir, **expected) 

69 

70 

71if __name__ == "__main__": 

72 unittest.main()