numpy.var fails on memmap
1 Feb
2011
1 Feb
'11
9:59 p.m.
Hi, numpy.var on a memory mapped array returns a 0-d memmap object instead of a scalar (like with numpy arrays):
import numpy as np fp = np.memmap('test.mm', dtype='float32', mode='w+', shape=(10,)) fp[:] = np.random.rand(10) fp_var= np.var(fp) print type(fp_var)
print fp_var.ndim 0
Moreover, the obtained object is missing 'filename' attribute, so that it can not be reused in further calculations:
fp_std = np.sqrt(fp_var) ... AttributeError: 'memmap' object has no attribute 'filename'
I can produce this bug in numpy 1.5.1 with python2.6 (from macports). Cheers, Bartosz Institute for Theoretical Biology Humboldt University of Berlin Germany http://neuroscience.telenczuk.pl
4805
Age (days ago)
4805
Last active (days ago)
0 comments
1 participants
participants (1)
-
Bartosz Telenczuk