Coverage for tests/test_coord.py: 43%

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

28 statements  

1# 

2# LSST Data Management System 

3# Copyright 2012-2016 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# 

22 

23 

24import unittest 

25 

26import numpy as np 

27from numpy.testing import assert_allclose 

28 

29import lsst.utils 

30 

31from lsst.validate.drp import util 

32 

33 

34class CoordTestCase(unittest.TestCase): 

35 """Testing basic coordinate calculations.""" 

36 

37 def setUp(self): 

38 self.simpleRa = np.deg2rad([15, 25]) 

39 self.simpleDec = np.deg2rad([30, 45]) 

40 self.zeroDec = np.zeros_like(self.simpleRa) 

41 

42 self.wrapRa = [359.9999, 0.0001, -0.1, +0.1] 

43 self.wrapDec = [1, 0, -1, 0] 

44 

45 self.simpleRms = [0.1, 0.2, 0.05] 

46 self.annulus = [1, 2] 

47 self.magrange = [20, 25] 

48 

49 def tearDown(self): 

50 pass 

51 

52 def testZeroDecSimpleAverageCoord(self): 

53 meanRa, meanDec = util.averageRaDec(self.simpleRa, self.zeroDec) 

54 assert_allclose([20, 0], np.rad2deg([meanRa, meanDec])) 

55 

56 def testSimpleAverageCoord(self): 

57 meanRa, meanDec = util.averageRaDec(self.simpleRa, self.simpleDec) 

58 assert_allclose([19.493625, 37.60447], np.rad2deg([meanRa, meanDec])) 

59 

60 

61def setup_module(module): 

62 lsst.utils.tests.init() 

63 

64 

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

66 lsst.utils.tests.init() 

67 unittest.main()