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

David Douard david.douard@logilab...
Mon Oct 27 06:51:00 CDT 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@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: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://projects.scipy.org/pipermail/numpy-discussion/attachments/20081027/7d1937d7/attachment-0001.bin 


More information about the Numpy-discussion mailing list