[SciPy-user] Periodic spline interpolation bug / memory error?

Travis Oliphant oliphant at ee.byu.edu
Wed Mar 15 18:54:38 EST 2006


Zachary Pincus wrote:

>Yes, the points are irregularly spaced. I'm actually using the  
>interpolation in a procedure to relax the spacing so that all points  
>*are* equally spaced.
>
>Right now, I'm working around this bug by overlapping the data on  
>each end, and not evaluating the spline only at some distance from  
>the ends. This works OK, in case anyone else needs to work around this.
>
>  
>
>>Hopefully your example will let us find the problem.
>>    
>>
I think I found the problem.  For this situation, the estimated for the 
number of knots needed was set to the expected value (but it could need 
more, which it did in your situation).  Then, this error was not handled 
well because the value of n under these conditions was not even being 
set (but was being used to allocate memory).

I committed two fixes to SVN:

1) The estimated number of knots was increased to the maximum needed 
(this alone removes the error
    you are seeing)

To see if this helps you go to

<site-packages>/scipy/interpolate/fitpack.py

line number 198

and change

nest = m/2

to

nest = m+2*k


This might be enough to fix the problem.


The second fix handles the error condition more gracefully, hopefully, 
then allocating a huge array....

2) If the error does show up, then don't assume 'n' is valid but set it 
to something sane.





More information about the SciPy-User mailing list