[Numpy-discussion] np.ma.masked_invalid and precision
bevan jenkins
bevan07@gmail....
Sun Oct 31 15:28:42 CDT 2010
Hello,
I am not sure if the following is a bug or not. I recently tried to set the
print precision in numpy but it didn't seem to make a difference. It seems
that the use of np.ma.masked_invalid results in arrays printing precision of
12 regardless of the default setting or any subsequent setting. Generating
masked arrays does not seem to have this behaviour. Is this a bug or am I
doing it wrong?
Thanks,
Bevan
In [1]: eg = np.random.random(1)
In [2]: eg_mask = np.ma.masked_array(eg)
In [3]: eg_mask_invalid = np.ma.masked_invalid(eg)
In [4]: eg
Out[4]: array([ 0.78592569])
In [5]: eg_mask
Out[5]:
masked_array(data = [ 0.78592569],
mask = False,
fill_value = 1e+20)
In [6]: eg_mask_invalid
Out[6]:
masked_array(data = [0.785925693305],
mask = [False],
fill_value = 1e+20)
In [7]: np.set_printoptions(precision=3)
In [8]: eg
Out[8]: array([ 0.786])
In [9]: eg_mask
Out[9]:
masked_array(data = [ 0.786],
mask = False,
fill_value = 1e+20)
In [10]: eg_mask_invalid
Out[10]:
masked_array(data = [0.785925693305],
mask = [False],
fill_value = 1e+20)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20101101/4d4afc8e/attachment.html
More information about the NumPy-Discussion
mailing list