Hide keyboard shortcuts

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# This file is part of fgcmcal. 

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/>. 

21"""Test the fgcmcal computeApertureRadius code with testdata_jointcal. 

22""" 

23 

24import unittest 

25import os 

26 

27import lsst.utils 

28import lsst.daf.persistence as dafPersist 

29 

30from lsst.fgcmcal.utilities import computeApertureRadius 

31 

32 

33class FgcmApertureTest(lsst.utils.tests.TestCase): 

34 @classmethod 

35 def setUpClass(cls): 

36 try: 

37 cls.dataDir = lsst.utils.getPackageDir('testdata_jointcal') 

38 except LookupError: 

39 raise unittest.SkipTest("testdata_jointcal not setup") 

40 

41 def test_fgcmApertureHsc(self): 

42 """ 

43 Test computeApertureRadius for HSC. 

44 """ 

45 lsst.log.setLevel("HscMapper", lsst.log.FATAL) 

46 

47 butler = dafPersist.Butler(os.path.join(self.dataDir, 'hsc')) 

48 

49 schema = butler.get('src_schema').schema 

50 

51 self.assertRaises(RuntimeError, computeApertureRadius, schema, 'base_PsfFlux_instFlux') 

52 self.assertRaises(LookupError, computeApertureRadius, schema, 'not_a_field') 

53 self.assertEqual(computeApertureRadius(schema, 'slot_CalibFlux_instFlux'), 12.0) 

54 self.assertEqual(computeApertureRadius(schema, 'base_CircularApertureFlux_12_0_instFlux'), 12.0) 

55 self.assertEqual(computeApertureRadius(schema, 'base_CircularApertureFlux_4_5_instFlux'), 4.5) 

56 

57 

58class TestMemory(lsst.utils.tests.MemoryTestCase): 

59 pass 

60 

61 

62def setup_module(module): 

63 lsst.utils.tests.init() 

64 

65 

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

67 lsst.utils.tests.init() 

68 unittest.main()