[SciPy-Dev] interp2d bounds checking

Ralf Gommers ralf.gommers at googlemail.com
Sun Jul 1 05:21:32 EDT 2012


On Mon, Jun 25, 2012 at 5:14 PM, Pierre Haessig <pierre.haessig at crans.org>wrote:

> Hi,
>
> I just have a small question about scipy.interpolate.interp2d
>
> I noticed that bounds checking when calling the interpolation instance
> seems to be ineffective.
> I found a ticket about this issue, but not much activity around it.
> http://projects.scipy.org/scipy/ticket/1072
>
> I looked at the code and at the documentation
>  (
>
> http://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.interp2d.html#scipy.interpolate.interp2d
>
> https://raw.github.com/scipy/scipy/master/scipy/interpolate/interpolate.py)
>
> and it seems that the `bounds_error` argument is never used in the
> initialization of the interp2d object (unlike inter1d).
> I'm not at all a specialist of 2D interpolation but I guess that bounds
> checking in 2D is not as easy as in 1D...
>
> Maybe, if there is no easy way to check bounds in interp2d, we should
> just add a "big warning" in the docstring stating that `bounds_error` is
> not currently used (and therefore `fill_value` as well).
> What do you think ?
>

Bounds checking on a 2-D grid isn't really more difficult than on a 1-D
grid. It looks like someone just copied the interp1d interface and then ran
out of time or energy to fully implement it.

Would be good if someone feels like implementing the missing bits, and
otherwise we should at least document that right now out-of-bounds input
simply raises an error (I didn't check which one).


> Best,
> Pierre
>
> about docstring editing, I didn't find the "Edit page" link on interp2d
> page. Did I miss something ?
>
> I see an edit button at
http://docs.scipy.org/scipy/docs/scipy.interpolate.interpolate.interp2d/.
Were you trying to find it there, or on the link you gave above (=built
docs).

Ralf


>
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20120701/96589155/attachment.html>


More information about the SciPy-Dev mailing list