[SciPy-user] using UnivariateSpline

Erik Tollerud erik.tollerud@gmail....
Fri May 22 17:38:30 CDT 2009

These classes are indeed rather poorly documented, but once you get
into them, they work very well.

Also, be aware that the three *UnivariateSpline classes are only
different in how they generate the knots:
*UnivarateSpline: determines the number of knots by adding more knots
until the smoothing condition (sum((w[i]*(y[i]-s(x[i])))**2,axis=0) <=
s) is satisfied - s is specified in the constructor or the
set_smoothing_factor method.
*LSQUnivariateSpline: the knots are specified in a sequence provided
to the constructor (t)
*InterpolatedUnivatiateSpline: the spline is forced to pass through
all the points (equivalent to s=0)

But they are all evaluated by being called, as has already been explained.

On Fri, May 22, 2009 at 1:26 PM, David Warde-Farley <dwf@cs.toronto.edu> wrote:
> On 22-May-09, at 3:57 PM, Robert Kern wrote:
>> On Fri, May 22, 2009 at 14:57, David Warde-Farley
>> <dwf@cs.toronto.edu> wrote:
>>> I must be crazy, but how does one actually USE UnivariateSpline, etc.
>>> to do interpolation? How do I evaluate the spline at other data after
>>> it's fit?
>>> There seems to be no "evaluate" method or equivalent to splev.
>>    def __call__(self, x, nu=None):
>>        """ Evaluate spline (or its nu-th derivative) at positions x.
>>        Note: x can be unordered but the evaluation is more efficient
>>        if x is (partially) ordered.
> I somehow completely missed this. I guess I was skipping over the
> __init__ method because I already understood it. :S
> Thanks Robert.
> David
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user

Erik Tollerud
Graduate Student
Center For Cosmology
Department of Physics and Astronomy
2142 Frederick Reines Hall
University of California, Irvine
Office Phone: (949)824-2587
Cell: (651)307-9409

More information about the SciPy-user mailing list