[Numpy-discussion] Views of memmaps and offset
Sat Sep 22 08:54:08 CDT 2012
I am struggling with offsets on the view of a memmaped array. Consider
import numpy as np
a = np.memmap('tmp.mmap', dtype=np.float64, shape=50, mode='w+')
a[:] = np.arange(50)
b = a[10:]
Here, I have a.offset == 0 and b.offset == 0. In practice, the data in b
is offset compared to the start of the file, given that it is a view
computed with an offset.
My goal is, given b, to find a way to open a new view on the file, e.g.
in a different process. For this I need the offset.
Any idea of how I can retrieve it? In the previous numpy versions, I
could go from b to a using the 'base' attribute of a. This is no longer
Also, should the above behavior be considered as a bug?
More information about the NumPy-Discussion