Speedup scipy griddata for multiple interpolations between two irregular grids

There are several things going on every time you make a call to scipy.interpolate.griddata: First, a call to sp.spatial.qhull.Delaunay is made to triangulate the irregular grid coordinates. Then, for each point in the new grid, the triangulation is searched to find in which triangle (actually, in which simplex, which in your 3D case will be … Read more

How to perform interpolation on a 2D array in MATLAB

Here is an example using scatteredInterpolant: %# get some 2D matrix, and plot as surface A = peaks(15); subplot(121), surf(A) %# create interpolant [X,Y] = meshgrid(1:size(A,2), 1:size(A,1)); F = scatteredInterpolant(X(:), Y(:), A(:), ‘linear’); %# interpolate over a finer grid [U,V] = meshgrid(linspace(1,size(A,2),50), linspace(1,size(A,1),50)); subplot(122), surf(U,V, F(U,V)) Note that you can evaluate the interpolant object at … Read more

Interpolation over an array (or two)

The other answers give you linear interpolations — these don’t really work for complex, nonlinear data. You want a spline fit, (spline interpolation) I believe. Spline fits describe regions of the data using a set of control points from the data, then apply a polynomial interpolation between control points. More control points gives you a … Read more

Fast interpolation of grid data

Sure! There are two options that do different things but both exploit the regularly-gridded nature of the original data. The first is scipy.ndimage.zoom. If you just want to produce a denser regular grid based on interpolating the original data, this is the way to go. The second is scipy.ndimage.map_coordinates. If you’d like to interpolate a … Read more

How do you do bicubic (or other non-linear) interpolation of re-sampled audio data?

My favorite resource for audio interpolating (especially in resampling applications) is Olli Niemitalo’s “Elephant” paper. I’ve used a couple of these and they sound terrific (much better than a straight cubic solution, which is relatively noisy). There are spline forms, Hermite forms, Watte, parabolic, etc. And they are discussed from an audio point-of-view. This is … Read more