[SciPy-Dev] interp2d bounds checking
Ralf Gommers
ralf.gommers@googlemail....
Fri Jul 6 11:19:50 CDT 2012
On Sun, Jul 1, 2012 at 8:40 PM, Pauli Virtanen <pav@iki.fi> wrote:
> 01.07.2012 11:21, Ralf Gommers kirjoitti:
> [clip]
> > 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).
>
> IMO, interp2d should be deprecated.
>
> It is equivalent to SmoothBivariateSpline with s=0.
>
> It's sort of a almost-name-alias for a Matlab function, but it works
> differently --- scattered data interpolation vs. grid interpolation.
> However, as FITPACK's 2-D scattered data splines not so rarely explode
> with real data, I don't think this "replacement function" does its work
> properly, so it should be deprecated. If the users want these 2-D
> splines, it's better to make them ask for them explicitly...
>
> We can maybe think about adding a deprecation category "deprecated and
> removed from documentation, but we'll keep it around indefinitely for
> backwards compatibility". Move to e.g. to a new file '_deprecated.py' to
> keep the moldy code separate.
>
This sounds like a good idea. interp2d is widely used I think, and we don't
usually deprecate functions like that.
> ***
>
> What's needed is a proper grid-base interpolation. It would be rather
> easy to write a simple wrapper around ndimage.map_coordinates to get
> general spline interpolation. Such interpolants are also easy to
> construct up from the polynomial interpolants in Scipy.
>
> If someone is looking for something to do: *here* would be a nice, a
> relatively easy, and very likely a very useful project to work on.
>
> ***
>
> Also, where interp2d works, griddata should work better in most use cases.
>
> I've also been thinking about enlarging the griddata syntax from the
> possibly somewhat unfriendly
>
> griddata((x, y), z, (xi, yi), **kw)
> griddata((x, y, z), u, (xi, yi, zi), **kw)
>
> to the variable argument one
>
> griddata(x, y, z, xi, yi, **kw)
> griddata(x, y, z, u, xi, yi, zi, **kw)
>
> which may be more familiar to users. Thoughts?
That does look easier to use, but having two interfaces will be confusing.
And deprecating the old one will be painful. What exactly do you have in
mind to do here?
Ralf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-dev/attachments/20120706/9adb476a/attachment.html
More information about the SciPy-Dev
mailing list