[SciPy-Dev] Comment on scipy.interpolate.UnivariateSpline error

Padarn Wilson padarn@gmail....
Sun Sep 22 23:02:06 CDT 2013


Hi,

I (well actually a friend) was recently trying to fit a UnivariateSpline to
some data and then evaluate the derivative. The spline generated fine and
could be evaluated (it looked reasonable) but the derivative would give the
error:

File "/usr/lib/pytho
n2.7/dist-packages/scipy/interpolate/fitpack2.py", line 258, in derivatives
   raise ValueError("Error code returned by spalde: %s" % ier)
ValueError: Error code returned by spalde: 10


It turned out that the x-array input was not in ascending order, as the
documentation says is required. The exact data I was using lead to
non-ascending knots.

I recognise this error is not encountered if the documentation is followed,
but the error is uninformative, and it seems like an easy mistake to make.
Especially given the spline still looks fine otherwise.

In case anyone wants to reproduce the example, the data are:

2.651,1.421
2.581,1.36
2.494,1.256
2.398,1.186
2.328,1.116
2.232,1.046
2.11,0.951
2.041,0.881
1.945,0.837
1.84,0.794
1.727,0.733
1.631,0.689
1.57,0.663
1.483,0.602
1.413,0.567
1.291,0.515
1.203,0.488
1.108,0.445
0.994,0.392
0.898,0.349
0.802,0.314
0.724,0.279
0.619,0.253
0.523,0.218
0.419,0.183
0.314,0.14
0.253,0.096
0.157,0.078
0.087,0.044

Thanks,
Padarn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-dev/attachments/20130923/cfe99d8e/attachment-0001.html 


More information about the SciPy-Dev mailing list