[SciPy-user] partially reading a file...
Travis E. Oliphant
Wed Aug 6 13:14:35 CDT 2008
> Travis E. Oliphant a écrit :
>> Absolutely memory mapping still applies --- it's a perfect application
>> for it. But, you will probably need a 64-bit system.
> No problem.
>> Memory mapping is how the OS handles "virtual memory" which uses disk
>> space to increase main memory. You are just using that idea directly
>> with a memory mapped file.
> Thanks for the hint.
Use numpy.memmap --- look at the docstring for example use and help on
all the arguments available. But, something like this (untested):
a = numpy.memmap(<filename>, mode='r', dtype=float, shape=(nx,ny,nz))
b = a[:nx/4,:ny/4,:nz/4]
More information about the SciPy-user