[SciPy-user] What is fastest load/save matrix methods?

Francesc Altet falted at pytables.org
Wed Dec 21 07:44:58 EST 2005


A Dimecres 21 Desembre 2005 00:16, Dave Kuhlman va escriure:
>    A two dimension array seems to have been collapsed into a one
>    dimension array.
>
>    Or, did I not use tofile() or fromfile() correctly?

You did. As documentation says, tofile() is a very terse function that
just saves data, not metadata (like the shape or type). It is your
responsability to read the data and then assign it to a proper
container (with the adequate shape and type). On his part, PyTables
does save the metadata (this is one of the reasons it performs slower
on small arrays), and you don't need to worry about retrieving the
correct shape and type by hand.

> Oops.  The .bin files were created by io.write_array().  They are
> actually text files.  I should have changed the names to .txt or
> something similar.

Well, comparing PyTables with io.write_array is not fair because ASCII
files are really slow to read and write. A more appropriate contender
for PyTables would be the excellent NetCDF interface that comes with
Scientific Python
(http://starship.python.net/~hinsen/ScientificPython/). It is
generally more limited in terms of features than PyTables, but I've
made no speed comparisons between both (and that would be really
interesting to know about them).

Cheers,

-- 
>0,0<   Francesc Altet     http://www.carabos.com/
V   V   Cárabos Coop. V.   Enjoy Data
 "-"




More information about the SciPy-User mailing list