# [SciPy-User] Tensioned Spline interpolation

Jonathan Stickel jjstickel@gmail....
Thu Aug 30 12:30:44 CDT 2012

```Gary

I am not familiar with the "tension" terminology, but it sounds like a
smoothing parameter. scipy.interpolate.UnivariateSpline provides splines
with smoothing. You might also try the scikit "datasmooth"

http://pypi.python.org/pypi/scikits.datasmooth/0.61

While not exactly a spline implementation, it computes a trend-line
through 1D data with user-specified or automatically determined smoothing.

HTH,
Jonathan

On 8/30/12 10:08 , scipy-user-request@scipy.org wrote:
> Date: Thu, 30 Aug 2012 17:22:21 +1000
> From: gary ruben
> Subject: [SciPy-User] Tensioned Spline interpolation
>
> 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
```