Coverage for tests / test_imsim.py: 48%

40 statements  

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

1# This file is part of obs_lsst. 

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 COPYRIGHT file at the top-level directory of this distribution 

7# for details of code ownership. 

8# 

9# This program is free software: you can redistribute it and/or modify 

10# it under the terms of the GNU General Public License as published by 

11# the Free Software Foundation, either version 3 of the License, or 

12# (at your option) any later version. 

13# 

14# This program is distributed in the hope that it will be useful, 

15# but WITHOUT ANY WARRANTY; without even the implied warranty of 

16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

17# GNU General Public License for more details. 

18# 

19# You should have received a copy of the GNU General Public License 

20# along with this program. If not, see <http://www.gnu.org/licenses/>. 

21# 

22import os.path 

23import sys 

24import unittest 

25 

26import lsst.utils.tests 

27from lsst.geom import arcseconds, Extent2I 

28import lsst.afw.image 

29 

30from lsst.obs.lsst.testHelper import ObsLsstButlerTests, ObsLsstObsBaseOverrides 

31from lsst.obs.lsst import LsstCamImSim 

32 

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

34 

35 

36class TestImsim(ObsLsstObsBaseOverrides, ObsLsstButlerTests): 

37 instrumentDir = "imsim" 

38 DATAROOT = os.path.join(TESTDIR, "data", "input") 

39 

40 @classmethod 

41 def getInstrument(cls): 

42 return LsstCamImSim() 

43 

44 def setUp(self): 

45 dataIds = {'raw': {'exposure': 204595, 'name_in_raft': 'S20', 'raft': 'R11'}, 

46 'bias': {'exposure': 204595, 'name_in_raft': 'S20', 'raft': 'R11'}, 

47 'flat': {'exposure': 204595, 'name_in_raft': 'S20', 'raft': 'R11', 

48 'physical_filter': 'i_sim_1.4'}, 

49 'dark': {'exposure': 204595, 'name_in_raft': 'S20', 'raft': 'R11'} 

50 } 

51 self.setUp_tests(self._butler, dataIds) 

52 

53 ccdExposureId_bits = 34 

54 exposureIds = {'raw': 204595042, 

55 'bias': 204595042, 

56 'dark': 204595042, 

57 'flat': 204595042 

58 } 

59 filters = {'raw': 'i_sim_1.4', 

60 'bias': '_unknown_', 

61 'dark': '_unknown_', 

62 'flat': 'i_sim_1.4' 

63 } 

64 exptimes = {'raw': 30.0, 

65 'bias': 0.0, 

66 'dark': 1.0, 

67 'flat': 1.0 

68 } 

69 detectorIds = {'raw': 42, 

70 'bias': 42, 

71 'dark': 42, 

72 'flat': 42 

73 } 

74 detector_names = {'raw': 'R11_S20', 

75 'bias': 'R11_S20', 

76 'dark': 'R11_S20', 

77 'flat': 'R11_S20' 

78 } 

79 detector_serials = {'raw': 'ITL-3800C-102-Dev', 

80 'bias': 'ITL-3800C-102-Dev', 

81 'dark': 'ITL-3800C-102-Dev', 

82 'flat': 'ITL-3800C-102-Dev' 

83 } 

84 dimensions = {'raw': Extent2I(4352, 4096), 

85 'bias': Extent2I(4072, 4000), 

86 'dark': Extent2I(4072, 4000), 

87 'flat': Extent2I(4072, 4000), 

88 } 

89 sky_origin = (55.67759886, -30.44239357) 

90 raw_subsets = (({}, 1), 

91 ({'physical_filter': 'i_sim_1.4'}, 1), 

92 ({'physical_filter': 'foo'}, 0), 

93 ({'exposure': 204595}, 1), 

94 ({'exposure': 204595}, 1), 

95 ) 

96 linearizer_type = unittest.SkipTest 

97 self.setUp_butler_get(ccdExposureId_bits=ccdExposureId_bits, 

98 exposureIds=exposureIds, 

99 filters=filters, 

100 exptimes=exptimes, 

101 detectorIds=detectorIds, 

102 detector_names=detector_names, 

103 detector_serials=detector_serials, 

104 dimensions=dimensions, 

105 sky_origin=sky_origin, 

106 raw_subsets=raw_subsets, 

107 linearizer_type=linearizer_type 

108 ) 

109 

110 self.raw_filename = '00204595-R11-S20-det042.fits' 

111 

112 self.setUp_camera(camera_name='LSSTCam-imSim', 

113 n_detectors=189, 

114 first_detector_name='R01_S00', 

115 plate_scale=20.0 * arcseconds, 

116 ) 

117 

118 super().setUp() 

119 

120 

121class MemoryTester(lsst.utils.tests.MemoryTestCase): 

122 pass 

123 

124 

125def setup_module(module): 

126 lsst.utils.tests.init() 

127 

128 

129if __name__ == '__main__': 129 ↛ 130line 129 didn't jump to line 130 because the condition on line 129 was never true

130 setup_module(sys.modules[__name__]) 

131 unittest.main()