Coverage for tests/test_verifyCalib.py: 30%
41 statements
« prev ^ index » next coverage.py v6.5.0, created at 2023-03-03 02:55 -0800
« prev ^ index » next coverage.py v6.5.0, created at 2023-03-03 02:55 -0800
1# This file is part of cp_verify.
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 numpy as np
23import unittest
25import lsst.utils.tests
26import lsst.cp.verify as cpVerify
28from lsst.ip.isr import CrosstalkCalib
31class VerifyCrosstalkTestCase(lsst.utils.tests.TestCase):
32 """Unit test for stats code - crosstalk cases.
33 """
35 def test_crosstalk(self):
36 """Test a subset of the output values to identify that the
37 image stat methods haven't changed.
38 """
39 crosstalk = CrosstalkCalib(nAmp=2)
40 crosstalk.coeffs = np.array([[0.0, 1e-4], [1e-4, 0.0]])
41 crosstalk.coeffErr = np.array([[0.0, 1e-5], [1e-5, 0.0]])
42 crosstalk.coeffNum = np.array([[0, 100], [100, 0]])
43 crosstalk.coeffValid = np.array([[False, True], [True, False]], dtype=bool)
45 config = cpVerify.CpVerifyCrosstalkConfig()
46 task = cpVerify.CpVerifyCrosstalkTask(config=config)
47 results = task.run(crosstalk)
48 crosstalkStats = results.outputStats
50 self.assertEqual(crosstalkStats['DET']['N_AMP'], crosstalk.nAmp)
51 self.assertEqual(crosstalkStats['DET']['N_VALID'], 2)
53 self.assertFalse(crosstalkStats['SUCCESS'])
54 self.assertFalse(crosstalkStats['VERIFY']['NO_SIGNIFICANT_DETECTION'])
56 def test_crosstalkNull(self):
57 """Test a subset of the output values to identify that the
58 image stat methods haven't changed.
59 """
60 crosstalk = CrosstalkCalib(nAmp=2)
61 crosstalk.coeffs = np.array([[0.0, 1e-6], [1e-6, 0.0]]),
62 crosstalk.coeffErr = np.array([[0.0, 1e-5], [1e-5, 0.0]]),
63 crosstalk.coeffNum = np.array([[0, 100], [100, 0]]),
64 crosstalk.coeffValid = np.array([[False, False], [False, False]], dtype=bool)
66 config = cpVerify.CpVerifyCrosstalkConfig()
67 task = cpVerify.CpVerifyCrosstalkTask(config=config)
68 results = task.run(crosstalk)
69 crosstalkStats = results.outputStats
71 self.assertEqual(crosstalkStats['DET']['N_AMP'], crosstalk.nAmp)
72 self.assertEqual(crosstalkStats['DET']['N_VALID'], 0)
74 self.assertTrue(crosstalkStats['SUCCESS'])
75 self.assertTrue(crosstalkStats['VERIFY']['NO_SIGNIFICANT_DETECTION'])
78class MemoryTester(lsst.utils.tests.MemoryTestCase):
79 pass
82def setup_module(module):
83 lsst.utils.tests.init()
86if __name__ == "__main__": 86 ↛ 87line 86 didn't jump to line 87, because the condition on line 86 was never true
87 lsst.utils.tests.init()
88 unittest.main()