[SciPy-User] Tensioned Spline interpolation

gary ruben gary.ruben at gmail.com
Thu Aug 30 20:19:51 EDT 2012


Thanks Jonathan,
I think the UnivariateSpline is from the *other* fitpack on netlib,
which doesn't appear to support tensioned splines (aka tension
splines). As I understand it the smoothing parameter in
UnivariateSpline changes the spline from an interpolating spline that
passes through all data points to an approximating curve that passes
near the points. In contrast, a tensioned spline always passes through
all data points and is typically a cubic spline with extra knots added
to change the behaviour of the interpolating curve between the data
points.
Gary

On 31 August 2012 03:30, Jonathan Stickel <jjstickel at gmail.com> wrote:
> 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 at 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



More information about the SciPy-User mailing list