[SciPy-user] problems with splrep,splev
Christian K.
ckkart at hoc.net
Sat Apr 18 09:31:23 EDT 2009
Hi Warren,
Warren Weckesser schrieb:
> About the first error...
>
> On Fri, Apr 17, 2009 at 4:14 AM, Christian K. <ckkart at hoc.net
> <mailto: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].
Right, but then I don't get the meaning of xb and xe at all. What sense
does it make to choose a fit interval larger than the input data? IMHO
x[0] < xb < xe < x[-1] should hold but obviously the docs tell the opposite.
Christian
More information about the SciPy-User
mailing list