3

What would be a python equivalent for the INTERPOL function as seen in the following IDL code:

x  = interpol(a,b,c)

Thank You

Eric Brown
  • 13,774
  • 7
  • 30
  • 71

1 Answers1

1

In your notation, the IDL interp function uses a as the input values, b as input abscissa values and c is the desired abscissa values you want to interpolate onto.

In python (for 1D) it would be scipy.interpolate.interp1d:

from scipy import interpolate
interpfunc = interpolate.interp1d(b,a, kind='linear')
x=interpfuc(c)

scipy includes many more interpolation functions, including interp2d and griddata that you may find useful: http://docs.scipy.org/doc/scipy/reference/interpolate.html

E. Douglas
  • 234
  • 1
  • 3
  • 11