Coverage for tests/test_PixelFlags.py: 35%

35 statements  

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

1# This file is part of meas_base. 

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/>. 

21 

22import unittest 

23 

24import lsst.geom 

25import lsst.utils.tests 

26import lsst.meas.base.tests 

27 

28 

29class PixelFlagsTestCase(lsst.meas.base.tests.AlgorithmTestCase, lsst.utils.tests.TestCase): 

30 

31 def setUp(self): 

32 self.center = lsst.geom.Point2D(50.1, 49.8) 

33 self.bbox = lsst.geom.Box2I(lsst.geom.Point2I(-20, -30), 

34 lsst.geom.Extent2I(140, 160)) 

35 self.dataset = lsst.meas.base.tests.TestDataset(self.bbox) 

36 self.dataset.addSource(100000.0, self.center) 

37 

38 def tearDown(self): 

39 del self.center 

40 del self.bbox 

41 del self.dataset 

42 

43 def testNoFlags(self): 

44 task = self.makeSingleFrameMeasurementTask("base_PixelFlags") 

45 exposure, catalog = self.dataset.realize(10.0, task.schema, randomSeed=0) 

46 task.run(catalog, exposure) 

47 record = catalog[0] 

48 self.assertFalse(record.get("base_PixelFlags_flag")) 

49 self.assertFalse(record.get("base_PixelFlags_flag_edge")) 

50 self.assertFalse(record.get("base_PixelFlags_flag_interpolated")) 

51 self.assertFalse(record.get("base_PixelFlags_flag_interpolatedCenter")) 

52 self.assertFalse(record.get("base_PixelFlags_flag_saturated")) 

53 self.assertFalse(record.get("base_PixelFlags_flag_saturatedCenter")) 

54 self.assertFalse(record.get("base_PixelFlags_flag_cr")) 

55 self.assertFalse(record.get("base_PixelFlags_flag_crCenter")) 

56 self.assertFalse(record.get("base_PixelFlags_flag_bad")) 

57 

58 

59class TestMemory(lsst.utils.tests.MemoryTestCase): 

60 pass 

61 

62 

63def setup_module(module): 

64 lsst.utils.tests.init() 

65 

66 

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

68 lsst.utils.tests.init() 

69 unittest.main()