[AstroPy] LinearNDInterpolator

Jonathan Slavin jslavin at cfa.harvard.edu
Fri Apr 22 13:27:51 EDT 2011


Hi all,

I'm wondering if anyone has used the routine
scipy.interpolate.LinearNDInterpolator
>From what I can tell, it should do fast multidimensional linear
interpolations, which is something I could use.  My problem is that it
isn't well documented.  

What I have is a 3-D grid of data values and what I want is values at a
specific group of non-gridded points.  scipy.interpolate.griddata seems
to do the opposite to what I want -- given a set of (non-gridded) points
at which you know the data value, interpolate onto a regular grid.  It
seemed like LinearNDInterpolator was what I wanted, but it seems to want
the same input as griddata -- points at which the data value is known.
That is, it takes two inputs points and values where the number of
points must match the no. of values.  What I need is something more like
linearinterp(gridded_data, coords) -- that is, more like what
scipy.ndimage.map_coordinates does, but much faster and just linear
(rather than spline) interpolation.  I wrote a routine that does this,
and reasonably quickly, but it's pure python and not as fast as I'd
like.

Jon




More information about the AstroPy mailing list