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