Coverage for tests/test_imageExaminer.py: 48%
31 statements
« prev ^ index » next coverage.py v7.2.6, created at 2023-05-24 03:00 -0700
« prev ^ index » next coverage.py v7.2.6, created at 2023-05-24 03:00 -0700
1# This file is part of summit_utils.
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
23import tempfile
24import os
26import lsst.utils.tests
28from lsst.summit.utils.butlerUtils import makeDefaultLatissButler
29from lsst.summit.utils import ImageExaminer
30from lsst.summit.utils.bestEffort import BestEffortIsr
33class ImageExaminerTestCase(lsst.utils.tests.TestCase):
35 @classmethod
36 def setUpClass(cls):
37 try:
38 cls.butler = makeDefaultLatissButler()
39 except FileNotFoundError:
40 raise unittest.SkipTest("Skipping tests that require the LATISS butler repo.")
42 # Chosen to work on the TTS, summit and NCSA
43 cls.dataId = {'day_obs': 20200315, 'seq_num': 120, 'detector': 0}
44 cls.bestEffort = BestEffortIsr() # should always succeed if makeDefaultLatissButler works
45 cls.outputDir = tempfile.mkdtemp()
46 cls.outputFilename = os.path.join(cls.outputDir, 'testImageExaminer.jpg')
48 def test_imageExaminer(self):
49 """Test that the animator produces a large file without worrying about
50 the contents?
51 """
52 exp = self.bestEffort.getExposure(self.dataId)
53 imExam = ImageExaminer(exp,
54 doTweakCentroid=True,
55 boxHalfSize=105,
56 doForceCoM=False,
57 savePlots=self.outputFilename)
58 imExam.plot()
60 self.assertTrue(os.path.isfile(self.outputFilename))
61 self.assertTrue(os.path.getsize(self.outputFilename) > 100000)
64class TestMemory(lsst.utils.tests.MemoryTestCase):
65 pass
68def setup_module(module):
69 lsst.utils.tests.init()
72if __name__ == "__main__": 72 ↛ 73line 72 didn't jump to line 73, because the condition on line 72 was never true
73 lsst.utils.tests.init()
74 unittest.main()