Looking for triangulator/interpolator
Travis E. Oliphant
oliphant.travis at ieee.org
Fri May 26 22:29:26 EDT 2006
Grant Edwards wrote:
> I need to interpolate an irregularly spaced set of sampled
> points: Given a set of x,y,z points, I need to interpolate z
> values for a much finer x,y grid.
How many x,y,z points do you have?
Did you try the fitpack function bisplrep in scipy? It can work well as
long as you don't have too many starting points.
Here is an example of how to use it
from numpy import rand, exp, ogrid
from scipy import interpolate
x = 2*rand(20)-1
y = 2*rand(20)-1
z = (x+y)*exp(-6.0*(x*x+y*y))
tck = interpolate.bisplrep(x,y,z,s=0,xb=-1,xe=1,yb=-1,ye=1)
xnew = r_[-1:1:70j]
ynew = r_[-1:1:70j]
znew = interpolate.bisplev(xnew,ynew,tck)
There is a buglet that is fixed in SVN scipy that means you need to
enter xb, xe, yb, and ye manually.
-Travis
More information about the Python-list
mailing list