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

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

from __future__ import division, with_statement 

from builtins import zip 

from builtins import range 

import numpy as np 

import unittest 

import lsst.utils.tests 

import lsst.sims.utils as utils 

 

 

def setup_module(module): 

lsst.utils.tests.init() 

 

 

class KdTreeTestCase(unittest.TestCase): 

 

def testKDTreeAPI(self): 

""" 

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

""" 

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

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

 

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

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

 

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

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

 

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

 

 

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

pass 

 

 

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

lsst.utils.tests.init() 

unittest.main()