Hi,
We have found two problems with ndimage. I have filed a ticket #455 on
the scipy trac page. The first problem can be seen with this example:
> import numpy as n
> from scipy import ndimage as nd
> a = n.ones((10,5),dtype=n.float32) * 12.3
> x = nd.rotate(a,90.0)
> x
Out[17]:
array([[ 12.30000019, 12.30000019, 12.30000019, 12.30000019,
12.30000019, 12.30000019, 12.30000019, 12.30000019,
0. , 0. ],
[ 12.30000019, 12.30000019, 12.30000019, 12.30000019,
12.30000019, 12.30000019, 12.30000019, 12.30000019,
12.30000019, 12.30000019],
[ 12.30000019, 12.30000019, 12.30000019, 12.30000019,
12.30000019, 12.30000019, 12.30000019, 12.30000019,
12.30000019, 12.30000019],
[ 12.30000019, 12.30000019, 12.30000019, 12.30000019,
12.30000019, 12.30000019, 12.30000019, 12.30000019,
12.30000019, 12.30000019],
[ 12.30000019, 12.30000019, 12.30000019, 12.30000019,
12.30000019, 12.30000019, 12.30000019, 12.30000019,
12.30000019, 12.30000019]], dtype=float32)
}}}
Notice that the last two entries of the first row are now 0.
The second problem has to do with the reversing of byte order if you
have big-endian data on a little endian machine. Please see the example
below:
>>> a = N.ones ((2,3), dtype=N.float32) * 12.3
>>> a = a.byteswap()
>>> a.dtype = a.dtype.newbyteorder (">")
>>> print a
[[ 12.30000019 12.30000019 12.30000019]
[ 12.30000019 12.30000019 12.30000019]]
>>> print ndimage.rotate (a, 90.)
[[ 0.00000000e+00 -4.28378144e+08]
[ 0.00000000e+00 -4.28378144e+08]
[ -4.28378144e+08 -4.28378144e+08]]
I have taken a look at the ndimage python code and cannot find any
explicit calls to byteswap. I'm guessing something is funny in one of
the c-api calls. I haven't been able to track it down yet.
Chris