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

1from __future__ import division, with_statement 

2from builtins import zip 

3from builtins import range 

4import numpy as np 

5import unittest 

6import lsst.utils.tests 

7import lsst.sims.utils as utils 

8 

9 

10def setup_module(module): 

11 lsst.utils.tests.init() 

12 

13 

14class KdTreeTestCase(unittest.TestCase): 

15 

16 def testKDTreeAPI(self): 

17 """ 

18 Make sure the API provided by scipy to the kdTree algorithm is functional. 

19 """ 

20 _ra = np.linspace(0., 2.*np.pi) 

21 _dec = np.linspace(-np.pi, np.pi) 

22 

23 Ra, Dec = np.meshgrid(_ra, _dec) 

24 tree = utils._buildTree(Ra.flatten(), Dec.flatten()) 

25 

26 x, y, z = utils._xyz_from_ra_dec(_ra, _dec) 

27 indx = tree.query_ball_point(list(zip(x, y, z)), utils.xyz_angular_radius()) 

28 

29 self.assertEqual(indx.shape, _ra.shape) 

30 

31 

32class MemoryTestClass(lsst.utils.tests.MemoryTestCase): 

33 pass 

34 

35 

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

37 lsst.utils.tests.init() 

38 unittest.main() 

39