[SciPy-user] spline interpolation crashes

John Travers jtravs at gmail.com
Thu Nov 2 11:19:00 EST 2006


Hi Martin,

On 02/11/06, Martin Höfling <martin.hoefling at gmx.de> wrote:
> Hi there, spline interpolation crashes, any ideas why?
>
> Code:
>
>         print "X-Data:",xdata[i]
>         print "Z-Data:",zdata[i]
>         print "X-len:",len(xdata[i]),"Y-len:",len(zdata[i])
>         spl= interpolate.splrep(xdata[i],zdata[i],s=0)
>
> Output:
> X-Data: [0.0, 0.0, 0.029562700000000001, 0.22792699999999999,

You have a repeated x value here. The input x array to splrep must be
strictly increasing. i.e.  x[n-1] <  x[n] < x[n+1]

(This should be clearer in the documentation, I'll fix that).

Cheers,
John



More information about the SciPy-User mailing list