Coverage for tests/test_isrStatistics.py: 32%

34 statements  

« prev     ^ index     » next       coverage.py v7.2.5, created at 2023-05-18 02:35 -0700

1# This file is part of ip_isr. 

2# 

3# Developed for the LSST Data Management System. 

4# This product includes software developed by the LSST Project 

5# (https://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 <https://www.gnu.org/licenses/>. 

21import unittest 

22 

23import lsst.utils.tests 

24 

25from lsst.ip.isr.isrMock import RawMock 

26from lsst.ip.isr import IsrTask 

27 

28 

29class IsrStatisticsTestCase(lsst.utils.tests.TestCase): 

30 def setUp(self): 

31 config = IsrTask.ConfigClass() 

32 config.doAssembleCcd = True 

33 config.doOverscan = True 

34 config.overscan.fitType = 'MEDIAN_PER_ROW' 

35 config.doBias = False 

36 config.doDark = False 

37 config.doFlat = False 

38 config.doLinearize = False 

39 config.doCalculateStatistics = True 

40 config.doFringe = False 

41 config.isrStats.doBandingStatistics = True 

42 

43 self.task = IsrTask(config=config) 

44 self.exposure = RawMock().run() 

45 

46 self.overscans = [] 

47 for amp in self.exposure.getDetector().getAmplifiers(): 

48 overscanResults = self.task.overscanCorrection(self.exposure, amp) 

49 self.overscans.append(overscanResults) 

50 

51 def test_bandingStatistics(self): 

52 """Look at the banding on a raw mock image. 

53 

54 The value obtained is far larger than we expect in real data. 

55 """ 

56 bandingResults = self.task.isrStats.measureBanding(self.exposure, self.overscans) 

57 

58 self.assertFloatsAlmostEqual(bandingResults['DET_BANDING'], 153.6335, atol=1e2) 

59 

60 

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

62 pass 

63 

64 

65def setup_module(module): 

66 lsst.utils.tests.init() 

67 

68 

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

70 import sys 

71 setup_module(sys.modules[__name__]) 

72 unittest.main()