[SciPy-dev] scipy.interpolate.fitpack patch

John Travers jtravs at gmail.com
Thu Feb 8 05:24:17 EST 2007


On 07/02/07, Zachary Pincus <zpincus at stanford.edu> wrote:
> 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

Yes you are right. I will add your patch to the new fitpack - there
are only minor differences.
John



More information about the SciPy-Dev mailing list