[SciPy-User] KDTree IndexError
DParker@chromallo...
DParker@chromallo...
Fri Jul 20 08:08:56 CDT 2012
I'm using scipy.spatial.KDTree (version 0.10.1) to perform nearest
neighbor interpolation. Recently I've encountered an error when defining a
KDTree from certain sets of data. I have not been able to determine what
is unique about these data sets and the traceback doesn't provide much of
a clue to me. I was hoping someone might be familiar with the problem and
provide some insight into what is causing the failure, what to look for in
my data set, and how to avoid the failure.
The code which generates the traceback is:
tree = KDTree(zip(x2,y2,z2))
where x2, y2, and z2 are numpy arrays dtype float64. For one particular
data set which fails these have a length of 157,237, shape is (157237,).
As I said above I don't know what is unusual about the data that causes
the failure to occur. The traceback is copied below:
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "<input>", line 75, in interactivemode
File "C:\Python26\lib\site-packages\fluenttools\profile.py", line 740,
in commonnodes
tree = KDTree(zip(x2,y2,z2))
File "C:\Python26\lib\site-packages\scipy\spatial\kdtree.py", line 174,
in __init__
self.tree = self.__build(np.arange(self.n), self.maxes, self.mins)
File "C:\Python26\lib\site-packages\scipy\spatial\kdtree.py", line 238,
in __build
self.__build(idx[less_idx],lessmaxes,mins),
{Prior two lines repeated 974 times}
File "C:\Python26\lib\site-packages\scipy\spatial\kdtree.py", line 201,
in __build
data = self.data[idx]
IndexError: index must be either an int or a sequence
David G. Parker
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20120720/26fecb54/attachment.html
More information about the SciPy-User
mailing list