[Numpy-discussion] bug is arr.real for byteswapped array

Sebastian Haase haase at msg.ucsf.edu
Mon Aug 21 21:09:43 EDT 2006


Hi,
We just spend some time debugging some numpy image analysis code
where we finally noticed that our file was byte-swapped ;-).
Even though we got much crazier numbers, 
the test below already shows one bug in the a.real.max() line.
My numpy.__version__ is  '1.0b3.dev3015'  and this is run on pentium (little 
endian) Linux  (both 64bit and 32bit version give same results):

>>> a = N.arange(4, dtype='>c8')
>>> a
[ 0. +0.00000000e+00j  0. +1.00000000e+00j  0. +2.00000000e+00j
  0. +3.00000000e+00j]
>>> a.max()
(3+0j)
>>> a.real.max()
0.0
>>> a.imag.max()
4.60060298822e-41
>>> 
>>> a = N.arange(4, dtype='<c8')
>>> a.max()
(3+0j)
>>> a.real.max()
3.0
>>> a.imag.max()
0.0
>>> 

Can someone test this on a newer SVN version ?

Thanks,
Sebastian Haase




More information about the NumPy-Discussion mailing list