[SciPy-dev] Fwd: Nearest neighbour interpolation in scipy (ticket #305)

Tom Grydeland tom.grydeland at gmail.com
Wed May 30 08:48:16 EDT 2007


Hello all,

This is in relation to ticket #305 on trac,

http://projects.scipy.org/scipy/scipy/ticket/305

I made a "nearest neighbour" interpolation a while back and submitted
it on trac, but I suppose that's not the best way to have it noticed.
When I got a new version of scipy with a recent ubuntu upgrade, I
found that interpolate.py had morphed enough that my contribution
could no longer work, so I made a new one, which was also posted under
the same ticket on trac.

Since then, I've looked at the svn repository and found even more
substantial changes.  I downloaded rev. 3049 of interpolate.py and
I've tried making my implementation of nearest neighbour interpolation
in a form which I '''think''' should work against this revision.
Unfortunately, I don't have a way to test this.

The script I have used for testing is below.  If there is a framework
to which I can add an automatically run test case, please point me in
the right direction.

Cheers,

//togr

#!/usr/bin/python

import scipy.interpolate as interpolate

primes  = [ 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47 ];
nearest = interpolate.interp1d(primes, primes, 'nearest')

inear = nearest(range(50))

for i in range(len(inear)):
    print "%3d: %3d" % (i, inear[i])


--
Tom Grydeland
  <Tom.Grydeland@(phys.uit.no|gmail.com)>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rev3049-patch
Type: application/octet-stream
Size: 3345 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20070530/5102b62a/attachment.obj>


More information about the SciPy-Dev mailing list