Hi all, I have a problem with masked_object (and masked_values to) like in this sort example : ########################################### lionel[Données]8>test=array([1,2,3,inf,5]) lionel[Données]9>test = ma.masked_object(test, inf) lionel[Données]10>print test[3], type(test[3]) -- <class 'numpy.core.ma.MaskedArray'> lionel[Données]11>print test.max(), type(test.max()) 5.0 <type 'float64scalar'> lionel[Données]12>test[3] == test.max() Sortie[12]: array(data = [True], mask = True, fill_value=?) ########################################### Why 5.0 == -- return True? A float is it the same as a masked object? thanks -- Lionel Roubeyrie - lroubeyrie@limair.asso.fr LIMAIR http://www.limair.asso.fr
On 4/25/06, Lionel Roubeyrie <lroubeyrie@limair.asso.fr> wrote:
Why 5.0 == -- return True? A float is it the same as a masked object? thanks
It does not. It returns ma.masked :
test[3] is ma.masked True
You should not access masked data - it makes no sense. The current behavior is historical and I don't really like it. Masked scalars are replaced by ma.masked singleton in subscript operations to allow a[i] is masked idiom. In my view it is not worth the trouble, but my suggestion to get rid of that feature was not met with much enthusiasm.
Hi, thanks for your answer, but my problem is that I want to obtain the index of the max value in each column of a 2d masked array, then how can I do that without comparaison? Thanks Le Mardi 25 Avril 2006 15:10, Sasha a écrit :
On 4/25/06, Lionel Roubeyrie <lroubeyrie@limair.asso.fr> wrote:
Why 5.0 == -- return True? A float is it the same as a masked object? thanks
It does not. It returns ma.masked :
test[3] is ma.masked
True
You should not access masked data - it makes no sense. The current behavior is historical and I don't really like it. Masked scalars are replaced by ma.masked singleton in subscript operations to allow a[i] is masked idiom. In my view it is not worth the trouble, but my suggestion to get rid of that feature was not met with much enthusiasm.
------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642 _______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
-- Lionel Roubeyrie - lroubeyrie@limair.asso.fr LIMAIR http://www.limair.asso.fr
On 4/27/06, Lionel Roubeyrie <lroubeyrie@limair.asso.fr> wrote:
[....................] I want to obtain the index of the max value in each column of a 2d masked array, then how can I do that without comparaison?
ma.argmax(x, axis=0, fill_value=ma.maximum_fill_value(x)) or better: argmax(x.fill(ma.maximum_fill_value(x)), axis=0)
participants (2)
-
Lionel Roubeyrie
-
Sasha