[SciPy-User] Tensioned Spline interpolation

gary ruben gary.ruben at gmail.com
Thu Aug 30 03:22:21 EDT 2012


Hi,

I'm rewriting some IDL code in Python. The original code uses IDL's
spline function to interpolate a 1D ungridded data series onto a
regular grid. Unfortunately, I can't find a close enough equivalent in
scipy. I'm guessing the IDL spline function implements a "tensioned
spline."

The signature of the IDL spline function is
Result = SPLINE(X, Y, T [, Sigma])
where Sigma is 'The amount of "tension" that is applied to the curve.
If sigma is close to 0, (e.g., .01), then effectively there is a cubic
spline fit. If sigma is large, (e.g., greater than 10), then the fit
will be like a polynomial interpolation.'

In the code I'm trying to reproduce, the author has set sigma=15 so
the result is quite different to a simple cubic spline.
Scipy's pchip algorithm gives a similar result, but is unfortunately
too slow for my application. Can anyone confirm that IDL's spline is a
tensioned spline routine? Does anyone know of a BSD-licensed Python
module that implements a tensioned spline. Failing that any
suggestions for a good routine I should look at wrapping (maybe Alan
Cline's fitpack on netlib?)

thanks,
Gary



More information about the SciPy-User mailing list