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

Travis Oliphant oliphant.travis at ieee.org
Tue Aug 22 11:36:14 CDT 2006


Sebastian Haase wrote:
> 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):
>
>   
I just fixed two bugs with respect to this issue which were introduced 
at various stages of development

1) The real and imag attribute getting functions were not respecting the 
byte-order of the data-type object of the array on creation of the 
"floating-point" equivalent data-type --- this one was introduced on the 
change to have byteorder part of the data-type object itself.

2) The copyswapn function for complex arrays was not performing two sets 
of swaps.  It was performing one large swap (which had the effect of 
moving the real part to the imaginary part and vice-versa).

These bug-fixes will be in 1.0b4

-Travis





More information about the Numpy-discussion mailing list