[SciPy-User] Splines in scipy.signal vs scipy.interpolation
Tony S Yu
Sat Feb 6 13:25:48 CST 2010
On Feb 5, 2010, at 6:00 PM, Dag Sverre Seljebotn wrote:
> Tony S Yu wrote:
>> I think I spoke too soon. I believe what I need are called a smoothing splines, which is what scipy.signal provides; on the other I hand, scipy.interpolate creates what I think are called regression splines. The difference being that regression splines smooth the data using fewer knots than the number of observed data, while smoothing splines have knots which match the (abscissa) location of the original data. (I don't use splines often, so please correct me if I'm misinterpreting what I've read about the topic.)
>> It's possible to specify knots or smoothing with interpolate.splrep, but when specifying both, the smoothing parameter is ignored and the knot placement (plus the error metric) determines the smoothness of the spline.
>> I'm trying to re-implement some matlab code (which uses matlab's spaps function) for spline optimization, and the algorithm requires smoothing splines (as opposed to regression splines). Any suggestions?
> I literally *just now* (the last hour) wrapped a small subset of the GSL
> splines in Cython. If you're interested tell me and I'll make available
> what I've got. Note that GSL is GPL.
> Dag Sverre
Thanks for your response.
I'm definitely interested to see what you have, but to be honest, the link you sent just made me more confused (as far as terminology goes). It sounds like the interpolating splines in GSL serve the same function as splines in scipy.interpolate without the ability to smooth the data; the spline passes through the data points and the spline is useful for taking derivatives, or as the name suggests, interpolating.
On the other hand, it sounds like GSL's basis splines act like splines in scipy.interpolate with smoothing turned on: smoothing is achieved using a reduced number of knots and a least squares fit.
What I think I need (and supposedly matlab's spaps provides) is a spline with knots at the data's x-values, plus smoothing---which means the spline doesn't necessarily go through the y-values of the data. (I wish I had a better understanding of all this so I could use the correct terminology.) Does GSL provide this sort of spline?
More information about the SciPy-User