[Numpy-discussion] Re: where
Ryan Krauss
ryanlists at gmail.com
Thu Apr 13 10:17:14 CDT 2006
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)
Ryan
On 4/13/06, Ryan Krauss <ryanlists at gmail.com> wrote:
> > Why? The condition array that you would pass into where() is already such an array.
>
> That is the key point I was missing. Until I played around with the
> conditions myself I didn't get that I was passing in an explicit array
> of 1's and 0's. I guess I thought I was passing in some magic
> expression that where was some how making sense. That is why I
> thought I would need to pass f and phase to the function.
>
> Ryan
>
> On 4/13/06, Robert Kern <robert.kern at gmail.com> wrote:
> > Ryan Krauss wrote:
> > > f and phase are each (4250,)
> > >
> > > I have something that is working but doesn't use where. Can this be
> > > done easier using where:
> > >
> > > f1=f>19.5
> > > f2=f<38
> > > myf=f1&f2
> > > myp=phase>0
> > > myind=myf&myp
> > > correction=myind*-360
> > > newphase=phase+correction
> >
> > (untested)
> > phase[((f>19.5) & (f<38)) & (phase>0)] -= 360
> >
> > > Basically, can where give me an output vector of the same size as f
> > > and phase where the output is either 1 or 0?
> >
> > Why? The condition array that you would pass into where() is already such an array.
> >
> > --
> > Robert Kern
> > robert.kern at gmail.com
> >
> > "I have come to believe that the whole world is an enigma, a harmless enigma
> > that is made terrible by our own mad attempt to interpret it as though it had
> > an underlying truth."
> > -- Umberto Eco
> >
> >
> >
> > -------------------------------------------------------
> > 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