[SciPy-User] Interpolation in 3D with interp2d

Jana Schulz schrabacke at web.de
Thu Aug 12 16:35:09 EDT 2010


Hi, 
RectBivariateSpline() can not handle randomly spaced data (that's what the error message says). The option 'linear' in griddata works only for  constant spacing data. I attached the surface plot of my data and the txt-file including my data. 

As you see the surface plot works pretty well. All I want is to get any z-value  for a given x,y-position.  Sounds easy, but a didn't find any function besides interp2d. Here is the error message:

C:\Python26\lib\site-packages\scipy\interpolate\interpolate.py in __init__(self,
 x, y, z, kind, copy, bounds_error, fill_value)
 111             raise ValueError("Unsupported interpolation type.")
 112
--> 113         self.tck = fitpack.bisplrep(self.x, self.y, self.z, kx=kx, ky=ky
, s=0.)
 114
 115     def __call__(self,x,y,dx=0,dy=0):

C:\Python26\lib\site-packages\scipy\interpolate\fitpack.py in bisplrep(x, y, z,
w, xb, xe, yb, ye, kx, ky, task, s, eps, tx, ty, full_output, nxest, nyest, quie
t)
 780         raise OverflowError("Too many data points to interpolate")
 781     tx,ty,c,o = _fitpack._surfit(x,y,z,w,xb,xe,yb,ye,kx,ky,task,s,eps,
--> 782                                    tx,ty,nxest,nyest,wrk,lwrk1,lwrk2)
 783     _curfit_cache['tx']=tx
 784     _curfit_cache['ty']=ty

MemoryError:
WARNING: Failure executing file: <new-test.py>

any idea what it means?




-----Ursprüngliche Nachricht-----
Von: denis <denis-bz-gg at t-online.de>
Gesendet: 11.08.2010 14:48:23
An: scipy-user at scipy.org
Betreff: Re: [SciPy-User] Interpolation in 3D with interp2d

>On Aug 11, 10:01 am, Jana Schulz  wrote:
>> Hi everyone,
>>
>> thanks for all your answers. I still work on the problem.
>> I tried the splines and its working but not linear, which ist the most important thing.
>
>Jana,
>
>griddata( ... interp="linear" ) is much like TriScatteredInterp for
>ndim=2,
>interpolates a plane over each triangle in a Delaunay triangulation.
>(The default interp="nn" is smoother but not linear.)
>Is "linear" what you want ?
>
>Repeat, are you doing BOTH griddata() to a grid of rectangles
>then RectBivariateSpline() inside those rectangles ?
>When you interpolate the corner values 0 0 0 1 inside a square,
>    0 -- 0
>    |      |
>    0  -- 1
>RectBivariateSpline( x,y,image, kx=1, ky=1 ) gives the function x*y,
>which is of course BI linear -- linear along horizontal and vertical
>lines,
>quadratic along diagonals like x == y.
>
>If you could post half-a-dozen of your points (f, z, A)
>with an expected interpolated value or two, that would help.
>
>cheers
>  -- denis
>_______________________________________________
>SciPy-User mailing list
>SciPy-User at scipy.org
>http://mail.scipy.org/mailman/listinfo/scipy-user
___________________________________________________________
Neu: WEB.DE De-Mail - Einfach wie E-Mail, sicher wie ein Brief!  
Jetzt De-Mail-Adresse reservieren: https://produkte.web.de/go/demail02
-------------- next part --------------
A non-text attachment was scrubbed...
Name: accuracy-map_v2.txt
Type: application/octet-stream
Size: 11171 bytes
Desc: not available
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20100812/64668b5b/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: surface.png
Type: application/octet-stream
Size: 163391 bytes
Desc: not available
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20100812/64668b5b/attachment-0001.obj>


More information about the SciPy-User mailing list