From: Sebastian H. <ha...@ms...> - 2006-08-22 01:09:46
|
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 |
From: Steve L. <lis...@ar...> - 2006-08-22 02:09:00
|
Hi Sebastian, > 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'm getting the same results you are. I just recompiled numpy to the latest svn (1.0b4.dev3050) and am running your example on intel (32 bit) Mac OS X.4.7. -steve |
From: Albert S. <fu...@gm...> - 2006-08-22 08:46:23
|
Hello all > <snip> > > >>> a = N.arange(4, dtype='>c8') > >>> a.imag.max() > 4.60060298822e-41 Confirmed on Windows 32-bit with 1.0b4.dev3050. I created a ticket here: http://projects.scipy.org/scipy/numpy/ticket/265 Regards, Albert |
From: Sebastian H. <ha...@ms...> - 2006-08-22 16:36:36
|
Hi, probably related to this is that arr[2].real is read-only ... I noticed that you cannot assign to arr[2].real : >>> a[2].real =6 Traceback (most recent call last): File "<input>", line 1, in ? TypeError: attribute 'real' of 'genericscalar' objects is not writable >>> a.real[2] =6 >>> >>> a[2].real.flags CONTIGUOUS : True FORTRAN : True OWNDATA : True WRITEABLE : False ALIGNED : True UPDATEIFCOPY : False >>> a.real[2].flags <snipped unchanged fields> WRITEABLE : False >>> >>> a.real.flags CONTIGUOUS : False FORTRAN : False OWNDATA : False WRITEABLE : True >>> a[2].flags CONTIGUOUS : True FORTRAN : True OWNDATA : True WRITEABLE : False ALIGNED : True UPDATEIFCOPY : False Is the "not writable" restriction necessary ? Thanks, Sebastian Haase On Tuesday 22 August 2006 01:46, Albert Strasheim wrote: > Hello all > > > <snip> > > > > >>> a = N.arange(4, dtype='>c8') > > >>> a.imag.max() > > > > 4.60060298822e-41 > > Confirmed on Windows 32-bit with 1.0b4.dev3050. > > I created a ticket here: > > http://projects.scipy.org/scipy/numpy/ticket/265 > > Regards, > > Albert > > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Numpy-discussion mailing list > Num...@li... > https://lists.sourceforge.net/lists/listinfo/numpy-discussion |
From: Travis O. <oli...@ie...> - 2006-08-22 19:15:42
|
Sebastian Haase wrote: > Hi, > probably related to this is that > arr[2].real is read-only ... > > I noticed that you cannot assign > to arr[2].real : > No, that's unrelated. The problem is that arr[2] is a scalar and so it is immutable. When an array scalar is created you get a *copy* of the data. Setting it would not have the effect you imagine as the original data would go unchanged. The only exception to this is the array of type "void" which *does not* copy the data. -Travis |
From: Travis O. <oli...@ie...> - 2006-08-22 16:36:21
|
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 |