Coverage for tests/test_EvaluateLocalCalibration.py : 33%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1# This file is part of ap_association.
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/>.
22import unittest
24import lsst.geom
25import lsst.utils.tests
26import lsst.meas.base.tests
29class TestLocalPhotoCalibration(lsst.meas.base.tests.AlgorithmTestCase,
30 lsst.utils.tests.TestCase):
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)
39 def tearDown(self):
40 del self.center
41 del self.bbox
42 del self.dataset
44 def testPhotoCalib(self):
45 task = self.makeSingleFrameMeasurementTask("base_LocalPhotoCalib")
46 exposure, catalog = self.dataset.realize(10.0, task.schema, randomSeed=0)
47 task.run(catalog, exposure)
48 record = catalog[0]
50 calib = exposure.getPhotoCalib().getLocalCalibration(self.center)
51 calibErr = exposure.getPhotoCalib().getCalibrationErr()
52 self.assertEqual(record.get("base_LocalPhotoCalib"), calib)
53 self.assertEqual(record.get("base_LocalPhotoCalibErr"), calibErr)
56class TestLocalWcs(lsst.meas.base.tests.AlgorithmTestCase,
57 lsst.utils.tests.TestCase):
59 def setUp(self):
60 self.center = lsst.geom.Point2D(50.1, 49.8)
61 self.bbox = lsst.geom.Box2I(lsst.geom.Point2I(-20, -30),
62 lsst.geom.Extent2I(140, 160))
63 self.dataset = lsst.meas.base.tests.TestDataset(self.bbox)
64 self.dataset.addSource(100000.0, self.center)
66 def tearDown(self):
67 del self.center
68 del self.bbox
69 del self.dataset
71 def testCDMatrix(self):
72 task = self.makeSingleFrameMeasurementTask("base_LocalWcs")
73 exposure, catalog = self.dataset.realize(10.0,
74 task.schema,
75 randomSeed=0)
76 task.run(catalog, exposure)
77 record = catalog[0]
79 localCDMatrix = exposure.getWcs().getCdMatrix(self.center)
80 self.assertEqual(record.get("base_LocalWcs_CDMatrix_1_1"),
81 localCDMatrix[0, 0])
82 self.assertEqual(record.get("base_LocalWcs_CDMatrix_2_1"),
83 localCDMatrix[1, 0])
84 self.assertEqual(record.get("base_LocalWcs_CDMatrix_1_2"),
85 localCDMatrix[0, 1])
86 self.assertEqual(record.get("base_LocalWcs_CDMatrix_2_2"),
87 localCDMatrix[1, 1])
90class MemoryTester(lsst.utils.tests.MemoryTestCase):
91 pass
94def setup_module(module):
95 lsst.utils.tests.init()
98if __name__ == "__main__": 98 ↛ 99line 98 didn't jump to line 99, because the condition on line 98 was never true
99 lsst.utils.tests.init()
100 unittest.main()