Coverage for tests/test_FootprintArea.py: 41%

30 statements  

« prev     ^ index     » next       coverage.py v7.4.4, created at 2024-04-06 04:20 -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.meas.base.tests 

26import lsst.utils.tests 

27 

28 

29class FootprintAreaTestCase(lsst.meas.base.tests.AlgorithmTestCase, 

30 lsst.utils.tests.TestCase): 

31 

32 def setUp(self): 

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

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

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

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

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

38 

39 def tearDown(self): 

40 del self.center 

41 del self.bbox 

42 del self.dataset 

43 

44 def testSingleFramePlugin(self): 

45 schema = self.dataset.makeMinimalSchema() 

46 config = lsst.meas.base.CatalogCalculationTask.ConfigClass() 

47 config.plugins.names = set(["base_FootprintArea"]) 

48 task = lsst.meas.base.CatalogCalculationTask(config=config, 

49 schema=schema) 

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

51 task.run(catalog) 

52 record = catalog[0] 

53 self.assertEqual(record.getFootprint().getArea(), 

54 record.get("base_FootprintArea_value")) 

55 

56 

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

58 pass 

59 

60 

61def setup_module(module): 

62 lsst.utils.tests.init() 

63 

64 

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

66 lsst.utils.tests.init() 

67 unittest.main()