Coverage for tests/test_colorterms.py : 27%

Hot-keys 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#
4# Copyright 2008-2016 AURA/LSST.
5#
6# This product includes software developed by the
7# LSST Project (http://www.lsst.org/).
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 LSST License Statement and
20# the GNU General Public License along with this program. If not,
21# see <https://www.lsstcorp.org/LegalNotices/>.
22#
23import os
24import numbers
25import unittest
27import lsst.utils.tests
28import lsst.pipe.tasks.photoCal as photoCal
31def setup_module(module):
32 lsst.utils.tests.init()
35class ColortermOverrideTestCase(unittest.TestCase):
37 def setUp(self):
38 """Test that colorterms specific to HSC override correctly"""
39 colortermsFile = os.path.join(os.environ["OBS_SUBARU_DIR"], "config", "hsc", "colorterms.py")
40 self.photoCalConf = photoCal.PhotoCalConfig()
41 self.photoCalConf.colorterms.load(colortermsFile)
43 def testHscColorterms(self):
44 """Test that the colorterm libraries are formatted correctly"""
45 refBands = ["g", "r", "i", "z", "y"]
46 hscBands = ["g", "r", "i", "z", "y"]
47 for band in hscBands:
48 ct = self.photoCalConf.colorterms.getColorterm(band, photoCatName="hsc") # exact match
49 self.assertIn(ct.primary, refBands)
50 self.assertIn(ct.secondary, refBands)
51 self.assertIsInstance(ct.c0, numbers.Number)
52 self.assertIsInstance(ct.c1, numbers.Number)
53 self.assertIsInstance(ct.c2, numbers.Number)
55 def testSdssColorterms(self):
56 """Test that the colorterm libraries are formatted correctly"""
57 sdssBands = ["g", "r", "i", "z", "y"]
58 hscBands = ["g", "r", "i", "i2", "z", "y", "N816", "N921"]
59 for band in hscBands:
60 ct = self.photoCalConf.colorterms.getColorterm(band, photoCatName="sdss") # exact match
61 self.assertIn(ct.primary, sdssBands)
62 self.assertIn(ct.secondary, sdssBands)
63 self.assertIsInstance(ct.c0, numbers.Number)
64 self.assertIsInstance(ct.c1, numbers.Number)
65 self.assertIsInstance(ct.c2, numbers.Number)
67 def testPs1Colorterms(self):
68 """Test that the colorterm libraries are formatted correctly"""
69 ps1Bands = ["g", "r", "i", "z", "y"]
70 hscBands = ["g", "r", "r2", "i", "i2", "z", "y", "I945", "N387", "N468", "N515", "N527", "N656",
71 "N718", "N816", "N921", "N973", "N1010"]
73 for band in hscBands:
74 ct = self.photoCalConf.colorterms.getColorterm(band, photoCatName="ps1") # exact match
75 self.assertIn(ct.primary, ps1Bands)
76 self.assertIn(ct.secondary, ps1Bands)
77 self.assertIsInstance(ct.c0, numbers.Number)
78 self.assertIsInstance(ct.c1, numbers.Number)
79 self.assertIsInstance(ct.c2, numbers.Number)
82class MemoryTester(lsst.utils.tests.MemoryTestCase):
83 pass
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()