On Wednesday 15 November 2006 12:55, Keith Goodman wrote:
> I didn't know you could use masked arrays with matrices. I guess I
> took the name literally.

:) 
Please check the developer zone:
http://projects.scipy.org/scipy/numpy/wiki/MaskedArray
for an alternative implementation of masked arrays that support subclasses of 
ndarray.

> I think an easier way to use masked arrays would be to introduce a new
> thing called mis.
>
> I could make a regular matrix
>
> x  = M.rand(3,3)
>
> and assign a missing value
>
> x[0,0] = M.mis
>
> x would then behave as a missing array matrix.
....
> I think that would make missing arrays accessible to everyone.

Well, there's already something like that, sort of: MA.masked, or 
MA.masked_singleton. The emphasis here is on "sort of".

That works well if x is already a masked array. Else, a "ValueError: setting 
an array element with a sequence" is raised. I haven't tried to find where 
the problem comes from (ndarray.__setitem__ ? The masked_singleton larger 
than it seems ?), but I wonder whether it's an issue worth solving.

If you want to get a masked_matrix from x, just type x=masked_array(x). You 
won't be able to access some specific matrix attributes (A, T), at least 
directly, but you can fill your masked_matrix and get a matrix back. And 
multiplication of two masked_matrices work as expected ! 

The main advantage of this approach is that we don't overload ndarray or 
matrices, the work is solely on the masked_array side.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion

Reply via email to