[SciPy-User] Bug in ndimage.map_coordinates with mode='wrap' ?
Kurt Smith
kwmsmith at gmail.com
Wed May 12 13:36:22 EDT 2010
On Mon, Mar 22, 2010 at 11:24 AM, Kurt Smith <kwmsmith at gmail.com> wrote:
> On Mon, Mar 22, 2010 at 11:20 AM, Kurt Smith <kwmsmith at gmail.com> wrote:
>> 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.
>
> I forgot to include:
>
> In [39]: sp.version.version
> Out[39]: '0.8.0.dev6120'
>
Looks like the above is another version of this bug:
http://projects.scipy.org/scipy/ticket/796
It affects any scipy.ndimage routines that use mode='wrap'.
The patch has been helpfully submitted and it's in 'needs review'
status -- any chance it could see some action? Otherwise I'll just
patch scipy locally.
Kurt
More information about the SciPy-User
mailing list