How about:

numpy.fromfile(filename, dtype='>i2')

  Nadav

-----Original Message-----
From:   [EMAIL PROTECTED] on behalf of Pierre GM
Sent:   Fri 06-Apr-07 18:41
To:     Discussion of Numerical Python
Cc:     
Subject:        Re: [Numpy-discussion] problem reading binary data from file

On Friday 06 April 2007 12:14:20 Giorgio F. Gilestro wrote:

> Is there any way I could get a 1D array (no tuples please!) directly
> from the file?
> (BTW numpy.core.records.fromstring gives the same output)

numpy.core.records.fromfile (filename, formats='i2', byteorder='big')['f0']

With numpy.core.records, you create a record array. Just get the field ('f0' 
by default) to get a ndarray.

(I'm sure there's a simpler way, but that should do it for now).
_______________________________________________
Numpy-discussion mailing list
[email protected]
http://projects.scipy.org/mailman/listinfo/numpy-discussion



<<winmail.dat>>

_______________________________________________
Numpy-discussion mailing list
[email protected]
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to