Coverage for tests/test_colorterms.py: 44%

28 statements  

« prev     ^ index     » next       coverage.py v7.4.4, created at 2024-04-05 04:01 -0700

1# 

2# LSST Data Management System 

3# Copyright 2008-2017 LSST Corporation. 

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 numbers 

24import unittest 

25 

26from lsst.utils import getPackageDir 

27import lsst.utils.tests 

28import lsst.pipe.tasks.photoCal as photoCal 

29 

30 

31class ColortermOverrideTestCase(unittest.TestCase): 

32 

33 """Test that colorterms specific to CFHT override correctly""" 

34 

35 def setUp(self): 

36 colortermsFile = os.path.join(getPackageDir("obs_cfht"), "config", "colorterms.py") 

37 self.photoCalConf = photoCal.PhotoCalConfig() 

38 self.photoCalConf.colorterms.load(colortermsFile) 

39 

40 def testColorterms(self): 

41 """Test that the colorterm libraries are formatted correctly""" 

42 refFilters = ["u", "g", "r", "i", "z"] 

43 cfhtPhysicalFilters = ["u.MP9301", "g.MP9401", "r.MP9601", "i.MP9701", "z.MP9801"] 

44 for filter in cfhtPhysicalFilters: 

45 ct = self.photoCalConf.colorterms.getColorterm(filter, photoCatName="e2v") # exact match 

46 self.assertIn(ct.primary, refFilters) 

47 self.assertIn(ct.secondary, refFilters) 

48 self.assertIsInstance(ct.c0, numbers.Number) 

49 self.assertIsInstance(ct.c1, numbers.Number) 

50 self.assertIsInstance(ct.c2, numbers.Number) 

51 

52 

53def setup_module(module): 

54 lsst.utils.tests.init() 

55 

56 

57class MemoryTester(lsst.utils.tests.MemoryTestCase): 

58 pass 

59 

60 

61if __name__ == "__main__": 61 ↛ 62line 61 didn't jump to line 62, because the condition on line 61 was never true

62 lsst.utils.tests.init() 

63 unittest.main()