[SciPy-user] problems with splrep,splev

Warren Weckesser warren.weckesser at gmail.com
Fri Apr 17 11:39:54 EDT 2009


Hi Christian,

About the first error...

On Fri, Apr 17, 2009 at 4:14 AM, Christian K. <ckkart at hoc.net> wrote:

>
> Hi,
>
> I am having problems with the spline functions from scipy.interpolate.
> Reading
> the doc strings I expected the following to work:
>
> from scipy.interpolate import splev,splrep
> import numpy as N
> x = N.linspace(-4,10,5)
> y = x**2
> t,c,l = splrep(x,y,xb=0,xe=4)
>
> Traceback (most recent call last):
>  File "C:\pythonxy\python\lib\site-packages\scipy\interpolate\fitpack.py",
> line 406, in splrep
>    n,c,fp,ier = dfitpack.curfit(task, x, y, w, t, wrk, iwrk, xb, xe, k, s)
> error: (xb<=x[0]) failed for 1st keyword xb
>

The error message is telling you what the problem is.  From the docstring:

    Given the set of data points (x[i], y[i]) determine a smooth spline
    approximation of degree k on the interval xb <= x <= xe.

You have values in your x array outside the interval [xb,xe].


Warren
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20090417/7f557150/attachment.html>


More information about the SciPy-User mailing list