[SciPy-dev] scipy.interpolate.fitpack patch

Zachary Pincus zpincus at stanford.edu
Wed Feb 7 16:22:49 EST 2007


Hello,

The fitpack.py module in the sandbox/spline directory still contains  
some bugs relating to the patch that I submitted recently. I know  
that the 'spline' classes are the future, but I think that for some  
uses the fitpack functions will remain the best interface, so we  
should keep them up as best as possible.

Anyhow, the bug I mentioned (silently swallowing errors while trying  
to determine whether the c parameter in tck is a list-of-numbers or a  
list-of-arrays) remains in the new version of fitpack.py in a  
slightly different form. The problematic stanzas now look like:

try:
   c[0][0]
   <recurse on each element of c, collate the results, and return them>
except TypeError: pass
<process the 1D c parameter, returning something or raising a TypeError>

which as you can see still remains a bug, because if TypeError is  
raised in the recursive call, it will be silently swallowed, and c  
will be assumed to be 1D.

The patch that I sent out earlier (though targeted at interpolate/ 
fitpack.py instead of sandbox/spline/fitpack.py) contains a less- 
brittle fix that changes these stanzas to:

try:
   c[0][0]
   parametric = True
except:
   parametric = False
if parametric:
   <recurse on each element of c, collate the results, and return them>
else:
   <process the 1D c parameter, returning something or raising a  
helpful exception>

Should I re-send a similar patch for sandbox/spline/fitpack.py?

Thanks,

Zach




On Feb 7, 2007, at 6:38 AM, John Travers wrote:

> Hi all,
>
> I have just committed a fix for the problem with the parametric  
> spline fitting.
> So as far as I can tell the new spline module is ready for prime time.
> So I would be very grateful if people can test it!!
>
> All you need to do is enable the spline module in the sandbox and
> replace any imports from scipy.interpolate with scipy.sandbox.spline.
>
> Bugs are very welcome!
>
> Note this module is missing the insert method added recently (thanks
> to Zach) - should be fixed soon.
>
> Now I can finally pay attention to the interpolation methods. I have a
> new module ready based on radial basis functions that allows n-d
> interpolation of scattered data. I'll be committing it this week once
> I've ironed out a few bugs.
>
> John
> _______________________________________________
> Scipy-dev mailing list
> Scipy-dev at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-dev




More information about the SciPy-Dev mailing list