Coverage for tests/test_kdtree.py : 56%

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
10def setup_module(module):
11 lsst.utils.tests.init()
14class KdTreeTestCase(unittest.TestCase):
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)
23 Ra, Dec = np.meshgrid(_ra, _dec)
24 tree = utils._buildTree(Ra.flatten(), Dec.flatten())
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())
29 self.assertEqual(indx.shape, _ra.shape)
32class MemoryTestClass(lsst.utils.tests.MemoryTestCase):
33 pass
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()