#NEWLINE# def test_ckdtree_list_k( ) : #NEWLINE# #INDENT# n = 200 #NEWLINE# m = 2 #NEWLINE# klist = [ 1 , 2 , 3 ] #NEWLINE# kint = 3 #NEWLINE# np . random . seed ( 1234 ) #NEWLINE# data = np . random . uniform ( size = ( n , m ) ) #NEWLINE# kdtree = cKDTree ( data , leafsize = 1 ) #NEWLINE# ( dd , ii ) = kdtree . query ( data , klist ) #NEWLINE# ( dd1 , ii1 ) = kdtree . query ( data , kint ) #NEWLINE# assert_equal ( dd , dd1 ) #NEWLINE# assert_equal ( ii , ii1 ) #NEWLINE# klist = np . array ( [ 1 , 3 ] ) #NEWLINE# kint = 3 #NEWLINE# ( dd , ii ) = kdtree . query ( data , kint ) #NEWLINE# ( dd1 , ii1 ) = kdtree . query ( data , klist ) #NEWLINE# assert_equal ( dd1 , dd [ ( ... , ( klist - 1 ) ) ] ) #NEWLINE# assert_equal ( ii1 , ii [ ( ... , ( klist - 1 ) ) ] ) #NEWLINE# ( dd , ii ) = kdtree . query ( data , 1 ) #NEWLINE# ( dd1 , ii1 ) = kdtree . query ( data , [ 1 ] ) #NEWLINE# assert_equal ( len ( dd . shape ) , 1 ) #NEWLINE# assert_equal ( len ( dd1 . shape ) , 2 ) #NEWLINE# assert_equal ( dd , np . ravel ( dd1 ) ) #NEWLINE# assert_equal ( ii , np . ravel ( ii1 ) )