Re: [Numpy-discussion] Controlling endianness of ndarray.tofile()

2011-06-21 Thread Ben Forbes
Thanks Gary, that works. Out of interest I timed it: http://pastebin.com/HA4Qn9Ge On average the swapping incurred a 0.04 second penalty (compared with 1.5 second total run time) for a 4096x4096 array of 64-bit reals. So there is no real penalty. Cheers, Ben On Tue, Jun 21, 2011 at 8:37 PM, gar

Re: [Numpy-discussion] Controlling endianness of ndarray.tofile()

2011-06-21 Thread gary ruben
Hi Ben, based on this example I suspect the way to do it is with numpy.byteswap() and numpy.tofile() >From > we can do >>> A = np.array([1, 256, 8

[Numpy-discussion] Controlling endianness of ndarray.tofile()

2011-06-21 Thread Ben Forbes
Hi, On my system (Intel Xeon, Windows 7 64-bit), ndarray.tofile() outputs in little-endian. This is a bit inconvenient, since everything else I do is in big-endian. Unfortunately, scipy.io.write_arrray() is deprecated, and I can't find any other routines that write pure raw binary. Are there any o