[Numpy-discussion] surprising behavior of np.asarray on masked arrays

2013-12-05 Thread Faraz Mirzaei
Hi, If I pass a masked array through np.asarray, I get original unmasked array. Example: test = np.array([[1, 0], [-1, 3]]) testMasked = ma.masked_less_equal(test, 0) print testMasked [[1 --] [-- 3]] print testMasked.fill_value 99 print np.asarray(testMasked) [[ 1 0] [-1 3]]

Re: [Numpy-discussion] invalid correlation coefficient from np.ma.corrcoef

2013-09-26 Thread Faraz Mirzaei
Thanks Josef and Nathaniel for your responses. In the application that I have, I don't use the correlation coefficient matrix as a whole (so I don't care if it is PSD or not). I simply read the off-diagonal elements for pair-wise correlation coefficients. I use the pairwise correlation coefficient

[Numpy-discussion] invalid correlation coefficient from np.ma.corrcoef

2013-09-25 Thread Faraz Mirzaei
Hi everyone, I'm using np.ma.corrcoef to compute the correlation coefficients among rows of a masked matrix, where the masked elements are the missing data. I've observed that in some cases, the np.ma.corrcoef gives invalid coefficients that are greater than 1 or less than -1. Here's an example: