[SciPy-user] spline problem

Stefan van der Walt stefan@sun.ac...
Mon Sep 10 02:32:27 CDT 2007

Hi Peter

On Fri, Sep 07, 2007 at 03:07:28PM +0200, Peter Bienstman wrote:
> I'm trying to do spline interpolation of my data. When I try the final example 
> of http://www.scipy.org/Cookbook/Interpolation, everything works fine. 
> However, as soon as I adapt it to use my own data, I get this
> Traceback (most recent call last):
>   File "test.py", line 26, in ?
>     tckp,u = splprep([x,y],s=s,k=k,nest=-1,quiet=0)
>   File "/usr/lib64/python2.4/site-packages/scipy/interpolate/fitpack.py", line 
> 223, in splprep
>     nest,wrk,iwrk,per)
> SystemError: error return without exception set

Your code contains duplicate data points.  You can find them by doing

mask = ((diff(x) == 0) & (diff(y) == 0))
print x[mask]
print y[mask]

If I change or remove those values, everything works well (see

-------------- next part --------------
A non-text attachment was scrubbed...
Name: peter.py
Type: text/x-python
Size: 1798 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/scipy-user/attachments/20070910/ec3e051b/attachment.py 

More information about the SciPy-user mailing list