[SciPy-User] Bug in ndimage.map_coordinates with mode='wrap' ?

Kurt Smith kwmsmith@gmail....
Mon Mar 22 12:20:05 CDT 2010


Hi,

Testing the example code in ndimage.map_coordinate's docstring, I
can't get things to work with mode='wrap'.  What am I doing wrong?

In [31]: a
Out[31]:
array([[  0.,   1.,   2.],
       [  3.,   4.,   5.],
       [  6.,   7.,   8.],
       [  9.,  10.,  11.]])

In [32]: ndimage.map_coordinates(a, [range(5), [0]*5], order=1,
mode='wrap')  # should be 0, 3, 6, 9, 0 -- right?
Out[32]: array([ 0.,  3.,  6.,  9.,  3.])

In [33]: ndimage.map_coordinates(a, [[0]*4, range(4)], order=1,
mode='wrap')  # should be 0, 1, 2, 0 -- right?
Out[33]: array([ 0.,  1.,  2.,  1.])

Here's the output when extending the sampling range:

In [36]: ndimage.map_coordinates(a, [range(10), [0]*10], order=1,
mode='wrap')  # should be 0, 3, 6, 9, 0, 3, 6, 9, ...
Out[36]: array([ 0.,  3.,  6.,  9.,  3.,  6.,  0.,  3.,  6.,  0.])

In [37]: ndimage.map_coordinates(a, [[0]*8, range(8)], order=1, mode='wrap')
Out[37]: array([ 0.,  1.,  2.,  1.,  0.,  1.,  0.,  1.])


If it's a bug, where can I file a report, and what can I do to help
fix it?  Looks like the wrapping code is in a compiled extension
module -- I'll take a look.

Kurt


More information about the SciPy-User mailing list