[SciPy-user] issues while loading scatter data file with load() from pylab...

Alan G Isaac aisaac@american....
Thu Sep 13 09:33:47 CDT 2007

On Thu, Sep 13, 2007 at 12:40:41PM +0200, fred wrote:
> Using load() function from pylab, array returned is 
> a float64.  Is it possible to directly load it in float32 
> ?  I don't need the double precision.  And I saw nothing 
> with load? 

numpy.fromfile with a reshape?

Alan Isaac


>> help(numpy.fromfile)
Help on built-in function fromfile in module numpy.core.multiarray:

    fromfile(file=, dtype=float, count=-1, sep='') - array.

    Required arguments:
        file -- open file object or string containing file name.

    Keyword arguments:
        dtype -- type and order of the returned array (default float)
        count -- number of items to input (default all)
        sep -- separater between items if file is a text file (default "")

    Return an array of the given data type from a text or binary file. The
    'file' argument can be an open file or a string with the name of a file to
    read from.  If 'count' == -1 the entire file is read, otherwise count is the
    number of items of the given type to read in.  If 'sep' is "" it means to
    read binary data from the file using the specified dtype, otherwise it gives
    the separator between elements in a text file. The 'dtype' value is also
    used to determine the size and order of the items in 
    binary files...

More information about the SciPy-user mailing list