[SciPy-User] Fwd: KDTree IndexError

DParker at chromalloy.com DParker at chromalloy.com
Fri Jul 20 16:46:16 EDT 2012


Here it is. https://bitbucket.org/parkerdg/kdtree-failure

Thank you for your help!

David G. Parker



From:   Oleksandr Huziy <guziy.sasha at gmail.com>
To:     DParker at chromalloy.com
Date:   07/20/2012 04:07 PM
Subject:        Fwd: [SciPy-User] KDTree IndexError



Hi,

I have not received the files. Maybe it's best to upload them somewhere?

Cheers
--
Oleksandr

---------- Forwarded message ----------
From: <DParker at chromalloy.com>
Date: 2012/7/20
Subject: Re: [SciPy-User] KDTree IndexError
To: SciPy Users List <scipy-user at scipy.org>


Yes but the mailing list bounced back the email with the data attached due 
to size so I've emailed the file directly to you. 

I have two examples - one that works and one that causes a failure. 

Some info on the data: 
        Good                Bad         
        Min        Max        Min        Max 
X        -0.0551        0.0569        0.0610        0.0911 
Y        -0.0540        0.0350        -0.0586        0.0185 
Z        1.0589        1.0702        0.9121        1.0624 

I'll add that in the original script where I first encountered the KDTree 
failure there was some pre-processing of the data before building the 
KDTree: converting units, sorting the coordinates. I've recently 
eliminated all of the pre-processing and I still encountered the same 
failure. 

David G. Parker



From:        Oleksandr Huziy <guziy.sasha at gmail.com> 
To:        SciPy Users List <scipy-user at scipy.org> 
Date:        07/20/2012 01:02 PM 
Subject:        Re: [SciPy-User] KDTree IndexError 
Sent by:        scipy-user-bounces at scipy.org 




Hi,

is it possible to have x2,y2,z2 to test it?

Thanks
--
Oleksandr Huziy

2012/7/20 <DParker at chromalloy.com> 
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
_______________________________________________
SciPy-User mailing list
SciPy-User at scipy.org
http://mail.scipy.org/mailman/listinfo/scipy-user

_______________________________________________
SciPy-User mailing list
SciPy-User at scipy.org
http://mail.scipy.org/mailman/listinfo/scipy-user


_______________________________________________
SciPy-User mailing list
SciPy-User at scipy.org
http://mail.scipy.org/mailman/listinfo/scipy-user


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20120720/56d75a93/attachment.html>


More information about the SciPy-User mailing list