Coverage for tests/test_psfCandidateSelection.py: 38%
Shortcuts on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
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 <http://www.lsstcorp.org/LegalNotices/>.
21#
22import os
23import unittest
24import logging
26import lsst.afw.image as afwImage
27import lsst.utils.tests
28from lsst.utils import getPackageDir
29from lsst.pipe.tasks.characterizeImage import CharacterizeImageTask
32class PsfFlagTestCase(lsst.utils.tests.TestCase):
34 def setUp(self):
35 # Load sample input from disk
36 expPath = os.path.join(getPackageDir("pipe_tasks"), "tests", "data", "v695833-e0-c000-a00.sci.fits")
37 self.exposure = afwImage.ExposureF(expPath)
38 # set log level so that warnings do not display
39 logging.getLogger("lsst.characterizeImage").setLevel(logging.ERROR)
41 def tearDown(self):
42 del self.exposure
44 def testFlags(self):
45 # Test that all of the flags are defined and there is no reservation by default
46 # also test that used sources are a subset of candidate sources
47 task = CharacterizeImageTask()
48 results = task.run(self.exposure)
49 used = 0
50 reserved = 0
51 for source in results.sourceCat:
52 if source.get("calib_psf_used"):
53 used += 1
54 self.assertTrue(source.get("calib_psf_candidate"))
55 if source.get("calib_psf_reserved"):
56 reserved += 1
57 self.assertGreater(used, 0)
58 self.assertEqual(reserved, 0)
61class MemoryTester(lsst.utils.tests.MemoryTestCase):
62 pass
65def setup_module(module):
66 lsst.utils.tests.init()
69if __name__ == "__main__": 69 ↛ 70line 69 didn't jump to line 70, because the condition on line 69 was never true
70 lsst.utils.tests.init()
71 unittest.main()