[Numpy-discussion] difficulty with numpy.where
Dr. Phillip M. Feldman
pfeldman@verizon....
Thu Oct 1 11:55:50 CDT 2009
I've defined the following one-line function that uses numpy.where:
def sin_half_period(x): return where(0.0 <= x <= pi, sin(x), 0.0)
When I try to use this function, I get an error message:
In [4]: z=linspace(0,2*pi,9)
In [5]: sin_half_period(z)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
The truth value of an array with more than one element is ambiguous. Use
a.any
() or a.all()
Any suggestions will be appreciated.
--
View this message in context: http://www.nabble.com/difficulty-with-numpy.where-tp25702676p25702676.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.
More information about the NumPy-Discussion
mailing list