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

Nicolas ROUX nicolas.roux@st....
Mon Oct 27 07:51:46 CDT 2008


Thanks for all of you,
for this fast and good reply ;-)


Nicolas.

-----Original Message-----
From: numpy-discussion-bounces@scipy.org
[mailto:numpy-discussion-bounces@scipy.org] On Behalf Of David Douard
Sent: Monday, October 27, 2008 12:51 PM
To: numpy-discussion@scipy.org
Subject: Re: [Numpy-discussion] How to do: y[y<T] = y+T

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@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



More information about the Numpy-discussion mailing list