Coverage for tests/test_imsim.py: 46%

37 statements  

« prev     ^ index     » next       coverage.py v7.4.4, created at 2024-04-03 02:43 -0700

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 sys 

23import unittest 

24 

25import lsst.utils.tests 

26from lsst.geom import arcseconds, Extent2I 

27import lsst.afw.image 

28 

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

30from lsst.obs.lsst import LsstCamImSim 

31 

32 

33class TestImsim(ObsLsstObsBaseOverrides, ObsLsstButlerTests): 

34 instrumentDir = "imsim" 

35 

36 @classmethod 

37 def getInstrument(cls): 

38 return LsstCamImSim() 

39 

40 def setUp(self): 

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

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

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

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

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

46 } 

47 self.setUp_tests(self._butler, dataIds) 

48 

49 ccdExposureId_bits = 34 

50 exposureIds = {'raw': 204595042, 

51 'bias': 204595042, 

52 'dark': 204595042, 

53 'flat': 204595042 

54 } 

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

56 'bias': '_unknown_', 

57 'dark': '_unknown_', 

58 'flat': 'i_sim_1.4' 

59 } 

60 exptimes = {'raw': 30.0, 

61 'bias': 0.0, 

62 'dark': 1.0, 

63 'flat': 1.0 

64 } 

65 detectorIds = {'raw': 42, 

66 'bias': 42, 

67 'dark': 42, 

68 'flat': 42 

69 } 

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

71 'bias': 'R11_S20', 

72 'dark': 'R11_S20', 

73 'flat': 'R11_S20' 

74 } 

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

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

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

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

79 } 

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

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

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

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

84 } 

85 sky_origin = (55.67759886, -30.44239357) 

86 raw_subsets = (({}, 1), 

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

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

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

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

91 ) 

92 linearizer_type = unittest.SkipTest 

93 self.setUp_butler_get(ccdExposureId_bits=ccdExposureId_bits, 

94 exposureIds=exposureIds, 

95 filters=filters, 

96 exptimes=exptimes, 

97 detectorIds=detectorIds, 

98 detector_names=detector_names, 

99 detector_serials=detector_serials, 

100 dimensions=dimensions, 

101 sky_origin=sky_origin, 

102 raw_subsets=raw_subsets, 

103 linearizer_type=linearizer_type 

104 ) 

105 

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

107 

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

109 n_detectors=189, 

110 first_detector_name='R01_S00', 

111 plate_scale=20.0 * arcseconds, 

112 ) 

113 

114 super().setUp() 

115 

116 

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

118 pass 

119 

120 

121def setup_module(module): 

122 lsst.utils.tests.init() 

123 

124 

125if __name__ == '__main__': 125 ↛ 126line 125 didn't jump to line 126, because the condition on line 125 was never true

126 setup_module(sys.modules[__name__]) 

127 unittest.main()