[Scipy-tickets] [SciPy] #1412: Bug in griddata (Code does not return)
SciPy Trac
scipy-tickets@scipy....
Wed Mar 23 20:32:24 CDT 2011
#1412: Bug in griddata (Code does not return)
-------------------------------+--------------------------------------------
Reporter: schicketanz | Owner: somebody
Type: defect | Status: new
Priority: high | Milestone:
Component: scipy.interpolate | Version: 0.9.0
Keywords: griddata |
-------------------------------+--------------------------------------------
Old description:
> I have found a bug in griddata. The code does not return in my example.
> It is difficult to reduce the data, because then the code suddenly
> works. I have no idea what to do to locate the problem further.
>
> Here is the example code:
>
> import numpy as np
> from scipy.interpolate import griddata
>
> #coord is a circle with an regular grid
> coord = np.load('coord.data.npy')
> A = np.zeros(coord.shape[0])
> coordi = np.array([[ 0.02803372, -0.03142812]]) #This should return nan
>
> #This does not work (Code does not return)
> print griddata(coord, A, coordi)
>
> #The triangulation works
> from scipy.interpolate import LinearNDInterpolator
> ip = LinearNDInterpolator(coord, A, fill_value=np.nan)
> print 'triangulation works'
>
> #This works!
> #The point is outside the convex hull. The data near this point is
> defined by index
> index = (coord[:,0]>0.02) & (coord[:,0]<0.035) & (coord[:,1]>-0.04)
> print griddata(coord[index,:], A[index], coordi)
>
> #If the data is shifted or scaled the example works
New description:
I have found a bug in griddata. The code does not return in my example. It
is difficult to reduce the data, because then the code suddenly works. I
have no idea what to do to locate the problem further.
Here is the example code:
{{{
import numpy as np
from scipy.interpolate import griddata
#coord is a circle with an regular grid
coord = np.load('coord.data.npy')
A = np.zeros(coord.shape[0])
coordi = np.array([[ 0.02803372, -0.03142812]]) #This should return nan
#This does not work (Code does not return)
print griddata(coord, A, coordi)
#The triangulation works
from scipy.interpolate import LinearNDInterpolator
ip = LinearNDInterpolator(coord, A, fill_value=np.nan)
print 'triangulation works'
#This works!
#The point is outside the convex hull. The data near this point is defined
by index
index = (coord[:,0]>0.02) & (coord[:,0]<0.035) & (coord[:,1]>-0.04)
print griddata(coord[index,:], A[index], coordi)
#If the data is shifted or scaled the example works
}}}
--
Comment(by warren.weckesser):
Enclosed the code in the description with triple curly braces.
--
Ticket URL: <http://projects.scipy.org/scipy/ticket/1412#comment:2>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.
More information about the Scipy-tickets
mailing list