[SciPy-dev] Status of interpolate.interp2d

David Huard david.huard at gmail.com
Wed Jun 14 11:57:59 EDT 2006


Hi David,

There were (and are) still a couple of problems with interp2d. A patch is
attached for the problems I've able to solve. It now works for evaluating
the spline at one location, but not for arrays. However, I don't have time
to fiddle with it right now.

Cheers,

David

Here is a simple test case that works, with an example of what ought to work
in the future.

# Example of the use of interp2
from scipy import *

x,y = mgrid[0:pi:20j, 0:pi:21j]
z = sin(x*y)

I = interpolate.interp2d(x,y,z)

# Now it should be possible to interpolate anywhere inside the x,y grid.
# The answer should be around sin(1) = .84
print I(1.,1.)


# This should eventually work (but it still doesn't)
#1. I(ravel(x), ravel(y))
#2. I(x,y)







2006/6/12, David M. Cooke <cookedm at physics.mcmaster.ca>:
>
> On Mon, 12 Jun 2006 17:12:07 -0400
> "David Huard" <david.huard at gmail.com> wrote:
>
> > Hi,
> > Line 41 in interpolate.py should read
> >
> > if rank(self.x) > 2 or rank(self.y) > 2:
> >
> > instead of
> > if self.x > 2 or rank(self.y) > 2:
> >
> > When this is fixed and I call it to evaluate z at some point x,y, it
> > complains that it has no attribute tck. In fact, it seems that the
> spline is
> > not evaluated during __init__.  Should I understand that interp2d is
> getting
> > a rehaul and is currently broken ? If so, I'd like to help since I need
> it.
>
> Looks like interp2d was broken. I fiddled with it until calls to stuff
> matched the docstrings of other stuff (yes, I don't really know how to use
> it :-).
>
> From the log, Travis touched it at the end of May, so he may have broken
> it.
> There's no test case for it, so that's quite possible.
>
> So it may work now. If it does, send us a test case, then we can make sure
> it
> doesn't break again :D
>
> --
> |>|\/|<
>
> /--------------------------------------------------------------------------\
> |David M. Cooke
> http://arbutus.physics.mcmaster.ca/dmc/
> |cookedm at physics.mcmaster.ca
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20060614/9dfb7b3c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: interpolate.patch
Type: text/x-patch
Size: 753 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20060614/9dfb7b3c/attachment.bin>


More information about the SciPy-Dev mailing list