Coverage for tests/test_isrMisc.py: 33%
46 statements
« prev ^ index » next coverage.py v7.5.0, created at 2024-04-25 00:31 -0700
« prev ^ index » next coverage.py v7.5.0, created at 2024-04-25 00:31 -0700
1#
2# LSST Data Management System
3# Copyright 2008-2017 AURA/LSST.
4#
5# This product includes software developed by the
6# LSST Project (http://www.lsst.org/).
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the LSST License Statement and
19# the GNU General Public License along with this program. If not,
20# see <https://www.lsstcorp.org/LegalNotices/>.
21#
23import unittest
25import lsst.afw.geom as afwGeom
26import lsst.utils.tests
27import lsst.ip.isr.straylight as straylight
28import lsst.ip.isr.vignette as vignette
29import lsst.ip.isr.masking as masking
30import lsst.ip.isr.linearize as linearize
32import lsst.ip.isr.isrMock as isrMock
35class IsrMiscCases(lsst.utils.tests.TestCase):
37 def setUp(self):
38 self.inputExp = isrMock.TrimmedRawMock().run()
39 self.mi = self.inputExp.getMaskedImage()
41 def test_straylight(self):
42 """Assert that the straylight task does not error when given an
43 exposure.
44 """
45 task = straylight.StrayLightTask()
46 with self.assertRaises(NotImplementedError):
47 task.run(self.inputExp, None)
49 def test_vignette_doWrite(self):
50 """Assert that the vignette task does not error when given an exposure
51 """
52 config = vignette.VignetteConfig()
53 config.radius = 125.0
54 config.xCenter = 0.0
55 config.yCenter = 100.0
57 config.doWriteVignettePolygon = True
58 task = vignette.VignetteTask(config=config)
59 result = task.run(self.inputExp)
61 self.assertIsInstance(result, afwGeom.Polygon)
63 def test_masking(self):
64 """Assert that the camera-specific masking task does not error when
65 given an exposure.
66 """
67 task = masking.MaskingTask()
68 result = task.run(self.inputExp)
70 # DM-19707: ip_isr functionality not fully tested by unit tests
71 self.assertIsNone(result)
73 def test_linearize(self):
74 """Assert that the linearize task does not error when a linearity is
75 requested.
76 """
77 for linearityTypeName in ('LookupTable', 'Squared', 'Polynomial', 'Unknown'):
78 result = linearize.Linearizer().getLinearityTypeByName(linearityTypeName)
79 # These return the actual class to use, so use Equal instead of
80 # IsInstance.
81 if linearityTypeName == 'LookupTable':
82 self.assertEqual(result, linearize.LinearizeLookupTable, msg=f"{linearityTypeName}")
83 elif linearityTypeName == 'Squared':
84 self.assertEqual(result, linearize.LinearizeSquared, msg=f"{linearityTypeName}")
85 elif linearityTypeName == 'Polynomial':
86 self.assertEqual(result, linearize.LinearizePolynomial, msg=f"{linearityTypeName}")
87 else:
88 # DM-19707: ip_isr functionality not fully tested by unit tests
89 self.assertIsNone(result)
92class MemoryTester(lsst.utils.tests.MemoryTestCase):
93 pass
96def setup_module(module):
97 lsst.utils.tests.init()
100if __name__ == "__main__": 100 ↛ 101line 100 didn't jump to line 101, because the condition on line 100 was never true
101 lsst.utils.tests.init()
102 unittest.main()