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