July 15, 2013
1:04 a.m.
Hi Pierre,
I'm a bit surprised, though. Here's what I tried
np.version.version <<< 1.7.0 x = np.ma.array([1,2,3], mask=[0,1,0]) x.flags.writeable=False x[0]=-1 <<< ValueError: assignment destination is read-only
Thanks, it works perfectly =) Sorry, probably have overlooked this simple solution, tried to set x.data and x.mask directly. I noticed that this only protects the data, so mask also has to be set to read-only or be hardened to avoid accidental (un)masking. Gregorio