[Numpy-discussion] how-to "put" RAM-based numarray into memmap

Sebastian Haase haase at msg.ucsf.edu
Mon Nov 24 11:14:07 CST 2003


> Sebastian Haase wrote:
> >
> > Hi,
> > Suppose I have a 500MB-ram Computer and a 300MB ram-only (standard)
> > numarray.
> > Now I would like to "save" that onto harddrive (with a small header up
> > front
>
> How about:
>
> f = open(filename, 'wb')
> f.write(MyHeader)
> A.tofile(f)
>
> To read it back in, you need to know where your header ends, by either
> parsing it or using one of the same size every time, then you can use
> fromfile() to create an array form it.

The main reason for my question was just to find out if NUMARRAY supports
it, and how ?
Also I have many "bookkeeping" functions already implemented for the
memmap'd case.
(That is, I have a class with member methods operting on a member memmapped
array)
So if what I descibed is possible I could save myself form duplicating lot's
of code.

Essentially I was hoping for the most ellegant solution ;-)

Thanks,
Sebastian





More information about the Numpy-discussion mailing list