[SciPy-user] Arrayfns in numpy?

Alok Singhal as8ca@virginia....
Mon Mar 5 14:56:44 CST 2007

On 05/03/07: 20:24, Stephen Kelly wrote:
>    Is there some other way I should be doing interpolation using numpy,
>    or is the omission of arrayfns an oversight?

You could use the functions in scipy.interpolate.  For linear
interpolation, use something like:

from scipy.interpolate import interp1d

# x, y are the original data values
intp = interp1d(x, y)

# xx is an array of new x values for which to interpolate (or just a
# scalar)
yy = intp(xx)

If you can't use scipy, then it shouldn't be too hard to write your
own linear interpolation function.  You might find searchsorted()
function useful in that case (in case your original x data is not
regularly spaced).


Alok Singhal                               *   *          
Graduate Student, dept. of Astronomy   *           *     *
University of Virginia                                    
http://www.astro.virginia.edu/~as8ca/              *    * 

More information about the SciPy-user mailing list