[Numpy-discussion] How to do: y[y<T] = y+T

David Douard david.douard at logilab.fr
Mon Oct 27 07:51:00 EDT 2008


Le Monday 27 October 2008 12:41:06 Nicolas ROUX, vous avez écrit :
> Hello,
>
> I hope this is not a silly question ;-)
> I have a Numpy array, and I want to process it with :
>   "if the value is lower than Threshold, then increase by Threshold"
>
>
> I would like to translate it as:
>  y[y<Treshold] = y + Treshold

let's see :

y[y<T] += T

Is it what you want ?

>
> To benefit from the Numpy speed.
> But this doesn't work, any idea ?
>
> Thanks,
> Cheers,
> Nicolas.
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion



-- 
David Douard                        LOGILAB, Paris (France), +33 1 45 32 03 12
Formations Python, Zope, Debian :   http://www.logilab.fr/formations
Développement logiciel sur mesure : http://www.logilab.fr/services
Informatique scientifique :         http://www.logilab.fr/science
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20081027/7d1937d7/attachment.sig>


More information about the NumPy-Discussion mailing list