Coverage for tests / test_isrMisc.py: 35%
45 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-28 08:55 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-28 08:55 +0000
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 task = vignette.VignetteTask(config=config)
58 result = task.run(self.inputExp)
60 self.assertIsInstance(result, afwGeom.Polygon)
62 def test_masking(self):
63 """Assert that the camera-specific masking task does not error when
64 given an exposure.
65 """
66 task = masking.MaskingTask()
67 result = task.run(self.inputExp)
69 # DM-19707: ip_isr functionality not fully tested by unit tests
70 self.assertIsNone(result)
72 def test_linearize(self):
73 """Assert that the linearize task does not error when a linearity is
74 requested.
75 """
76 for linearityTypeName in ('LookupTable', 'Squared', 'Polynomial', 'Unknown'):
77 result = linearize.Linearizer().getLinearityTypeByName(linearityTypeName)
78 # These return the actual class to use, so use Equal instead of
79 # IsInstance.
80 if linearityTypeName == 'LookupTable':
81 self.assertEqual(result, linearize.LinearizeLookupTable, msg=f"{linearityTypeName}")
82 elif linearityTypeName == 'Squared':
83 self.assertEqual(result, linearize.LinearizeSquared, msg=f"{linearityTypeName}")
84 elif linearityTypeName == 'Polynomial':
85 self.assertEqual(result, linearize.LinearizePolynomial, msg=f"{linearityTypeName}")
86 else:
87 # DM-19707: ip_isr functionality not fully tested by unit tests
88 self.assertIsNone(result)
91class MemoryTester(lsst.utils.tests.MemoryTestCase):
92 pass
95def setup_module(module):
96 lsst.utils.tests.init()
99if __name__ == "__main__": 99 ↛ 100line 99 didn't jump to line 100 because the condition on line 99 was never true
100 lsst.utils.tests.init()
101 unittest.main()