|
From: Matthew B. <mat...@gm...> - 2007-02-07 12:29:28
|
Hi, > if it's just a block of bytes in a standard type from and n-d array, you > can use numpy.fromfile() I should also say that I have just committed a rewrite of the binary file reading stuff to scipy, so if you have the latest scipy SVN (as of a few minutes ago), you can do something like: from StringIO import StringIO import numpy as N from scipy.io import npfile arr = N.arange(10).reshape(5,2) # write in Fortran order, Big endian, read back in C, system endian my_file = StringIO() npf = npfile(my_file, order='F', endian='>') npf.write_array(arr) npf.rewind() npf.read_array((5,2), arr.dtype) Best, Matthew |