[SciPy-user] Error in scipy.spatial.cKDTree

Rob Hetland hetland at tamu.edu
Sat Feb 21 19:38:14 EST 2009


I am getting a strange error in scipy.spatial.cKDtree:


# make a sample array.
fill_value = 0.5
x = np.random.rand(25, 50)
x = x.clip(min=fill_value, max=inf)

# Create (i, j) point arrays for good and bad data.
# Bad data is marked by the fill_value, good data elsewhere.
igood = np.vstack(np.where(x!=fill_value)).astype('d').T
ibad = np.vstack(np.where(x==fill_value)).astype('d').T

# create a tree for the bad points, the points to be filled
tree = scipy.spatial.cKDTree(ibad)

# get the four closest points to the bad points
dist, iquery = tree.query(igood, k=4, p=2)

np.any(dist == 0)




I get True for the last command, which should not be.  Other  
implementations of kdtree that I have, including regular KDTree.  I'm  
not good enough at C to track the code down.

-Rob



----
Rob Hetland, Associate Professor
Dept. of Oceanography, Texas A&M University
http://pong.tamu.edu/~rob
phone: 979-458-0096, fax: 979-845-6331






More information about the SciPy-User mailing list