Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>NumPy provides <a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.fromfile.html" rel="noreferrer"><code>fromfile()</code></a> to read binary data.</p> <pre><code>a = numpy.fromfile("filename", dtype=numpy.float32) </code></pre> <p>will create a one-dimensional array containing your data. To access it as a two-dimensional Fortran-ordered <code>n x m</code> matrix, you can reshape it:</p> <pre><code>a = a.reshape((n, m), order="FORTRAN") </code></pre> <p>[EDIT: The <code>reshape()</code> actually copies the data in this case (see the comments). To do it without cpoying, use</p> <pre><code>a = a.reshape((m, n)).T </code></pre> <p>Thanks to Joe Kingtion for pointing this out.]</p> <p>But to be honest, if your matrix has several gigabytes, I would go for a HDF5 tool like <a href="http://h5py.alfven.org/" rel="noreferrer">h5py</a> or <a href="http://www.pytables.org/moin" rel="noreferrer">PyTables</a>. Both of the tools have FAQ entries comparing the tool to the other one. I generally prefer h5py, though PyTables seems to be more commonly used (and the scopes of both projects are slightly different).</p> <p><a href="http://en.wikipedia.org/wiki/Hierarchical_Data_Format#Interfaces" rel="noreferrer">HDF5</a> files can be written from most programming language used in data analysis. The list of interfaces in the linked Wikipedia article is not complete, for example there is also an <a href="http://cran.r-project.org/web/packages/hdf5/index.html" rel="noreferrer">R interface</a>. But I actually don't know which language you want to use to write the data...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload