[Numpy-discussion] Efficient reading of binary data
Jarrod Millman
millman at berkeley.edu
Fri Apr 4 05:33:38 EDT 2008
On Fri, Apr 4, 2008 at 1:50 AM, Sebastian Haase <haase at msg.ucsf.edu> wrote:
> Hi,
> Accidentally I'm exactly trying to do the same thing right now .....
>
> What is the best way of memmapping into a file that is already open !?
>
> I have to read some text (header info) off the beginning of the file
> before I know where the data actually starts.
> I could of course get the position at that point ( f.tell() ) close
> the file, and reopen using memmap.
> However this doesn't sound optimal to me ....
>
> Any hints ?
> Could numpy's memmap be changed to also accept file-objects, or there
> a "rule" that memmap always has to have access to the entire file ?
I am getting a little tired, so this may be incorrect. But I believe
Stefan modified memmaps to allow them to be created from file-like
object: http://projects.scipy.org/scipy/numpy/changeset/4856
Are you running a released version of NumPy or the trunk? If you
aren't using the trunk, could you give it a try? It would be good to
have it tested before the 1.0.5 release.
Cheers,
--
Jarrod Millman
Computational Infrastructure for Research Labs
10 Giannini Hall, UC Berkeley
phone: 510.643.4014
http://cirl.berkeley.edu/
More information about the NumPy-Discussion
mailing list