np.ma.masked_invalid and precision

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)

On Oct 31, 2010, at 9:28 PM, bevan jenkins wrote:
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?
Mmh, probably a bug, I'd say. Mind opening a ticket ? Thanks in advance P.

Pierre GM-2 wrote:
Mmh, probably a bug, I'd say. Mind opening a ticket ? Thanks in advance P.
Done - Ticket #1657 -- View this message in context: http://old.nabble.com/np.ma.masked_invalid-and-precision-tp30100542p30107931... Sent from the Numpy-discussion mailing list archive at Nabble.com.
participants (3)
-
bevan j
-
bevan jenkins
-
Pierre GM