[Numpy-discussion] Re: where

Ryan Krauss ryanlists at gmail.com
Tue Apr 18 05:31:15 CDT 2006


You are right.  I actually did run into a problem with this.  I was
trying to subtract 360 degrees from the phase of some fft data and I
multiplied -360 (no dot) times my bool array.  It took me a while to
track that one down.

Ryan

On 4/18/06, Johannes Loehnert <a.u.r.e.l.i.a.n at gmx.net> wrote:
> On Thursday 13 April 2006 19:16, Ryan Krauss wrote:
> > which makes this:
> > myvect=where((f>19.5) & (f<38) &
> > (phase>0),ones(shape(phase)),zeros(shape(phase)))
> >
> > actually really silly, sense all it is a complicated way to get back
> > the input of
> > (f>19.5) & (f<38) & (phase>0)
> >
>
> ...but you should cast the second to signed int32, otherwise
>
> a = (f>19.5) & (f<38) & (phase>0)
> print a-1
>
> will give an array of 0's and 255's :) (since boolean arrays are by default
> upcast to unsigned int8)
>
> Johannes
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting language
> that extends applications into web and mobile media. Attend the live webcast
> and join the prime developer group breaking into this new coding territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>




More information about the Numpy-discussion mailing list