[SciPy-user] partially reading a file...

fred fredmfp at gmail.com
Wed Aug 6 10:30:40 EDT 2008


Travis E. Oliphant a écrit :
> fred wrote:
>> Hi,
>>
>> Let's say I want to read a (binary) file which contains a nx*ny*nz array.
>>
>> Is it possible to read a "sub-array" from this file, ie each block of 
>> (nx/4, ny/4, nz/4) for instance, without loading the whole file ?
>>   
> An easy way to do this which forces the operating system to do the work 
> of partial loading is to use a memory mapped file as the source of the 
> array (i.e. a memmap array). 
> 
> Then, selecting out a block is as simple as slicing.
Maybe I had to mention this: the aim is to cut in several files a 
"large" data file, _bigger_ than total available memory amount.

Does memmap still apply ?

Cheers,

-- 
Fred



More information about the SciPy-User mailing list