Re: [Numpy-discussion] odd behaviour with basic operations

2009-11-01 Thread Benjamin Deschamps
Seems like this was a rookie mistake with code later in the function. Thanks for suggesting the use of numpy.where, that is a much better function for the purpose. Benjamin ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.sci

Re: [Numpy-discussion] odd behaviour with basic operations

2009-11-01 Thread Robert Kern
On Sun, Nov 1, 2009 at 21:09, Benjamin Deschamps wrote: > I am getting strange behaviour with the following code: > Pd = ((numpy.sign(C_02) == 1) * Pd_pos) + ((numpy.sign(C_02) == -1) * > Pd_neg) > Ps = ((numpy.sign(C_02) == 1) * Ps_pos) + ((numpy.sign(C_02) == -1) * > Ps_neg) > where Pd, Ps, C_02

[Numpy-discussion] odd behaviour with basic operations

2009-11-01 Thread Benjamin Deschamps
I am getting strange behaviour with the following code: Pd = ((numpy.sign(C_02) == 1) * Pd_pos) + ((numpy.sign(C_02) == -1) * Pd_neg) Ps = ((numpy.sign(C_02) == 1) * Ps_pos) + ((numpy.sign(C_02) == -1) * Ps_neg) where Pd, Ps, C_02, Pd_pos, Pd_neg, Ps_pos and Ps_neg are all Float32 numpy a