[SciPy-user] SciPy-user Digest, Vol 31, Issue 42

Lionel Roubeyrie lroubeyrie at limair.asso.fr
Fri Mar 31 01:26:12 CST 2006


Bonjour,
thanks for your comments, I'll not use nan object anymore :-P
Bonne journee

Le Vendredi 31 Mars 2006 04:23, Pierre GM a écrit :
> Salut,
>
> A couple of comments:
> > #####################################
> > lionel[donn?es]21>from scipy import *
> > lionel[donn?es]22>from numpy import ma as MA
> > lionel[donn?es]23>test=MA.masked_object([1,2,3,4,nan,6], nan)
> > lionel[donn?es]24>print amin(test), amax(test), mean(test)
>
> It's a very bad idea to use nan as a masking value, as (nan == nan) is
> always False. The mask construction will fail, and you won't have any value
> actually masked. You can use `inf` instead, that seems to work.
>
> > lionel[donn?es]26>print amin(test), amax(test), mean(test)
> > 1.0 6.0 3.2
>
> Try to use methods instead of functions. It should simplify your code and
> make it a bit more foolproof.
>
> A good part of scipy (a bit less of numpy) is not adapted to MaskedArrays.
> If you run into problems, please update the MaskedArray page of the wiki. A
> plus

-- 
Lionel Roubeyrie - lroubeyrie at limair.asso.fr
LIMAIR
http://www.limair.asso.fr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.scipy.net/pipermail/scipy-user/attachments/20060331/055ae08b/attachment.htm


More information about the SciPy-user mailing list