Re: [Numpy-discussion] runtime warning for where

2013-11-16 Thread Charles Waldman
> Don't forget that np.where is not smart And there's really no way it could be. np.where, like all Python functions, must evaluate all of the arguments first, then call the function. ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://m

Re: [Numpy-discussion] runtime warning for where

2013-11-16 Thread David J Pine
Thanks. I must have had runtime warnings turned off in my previous versions of python. On Sat, Nov 16, 2013 at 8:42 AM, alex wrote: > On Sat, Nov 16, 2013 at 8:28 AM, David Pine wrote: > > The program at the bottom of this message returns the following runtime > warning: > > > > python test.p

Re: [Numpy-discussion] runtime warning for where

2013-11-16 Thread Matthieu Brucher
Hi, Don't forget that np.where is not smart. First np.sin(x)/x is computed for the array, which is why you see the warning, and then np.where selects the proper final results. Cheers, Matthieu 2013/11/16 David Pine : > The program at the bottom of this message returns the following runtime > w

Re: [Numpy-discussion] runtime warning for where

2013-11-16 Thread alex
On Sat, Nov 16, 2013 at 8:28 AM, David Pine wrote: > The program at the bottom of this message returns the following runtime > warning: > > python test.py > test.py:5: RuntimeWarning: invalid value encountered in divide > return np.where(x==0., 1., np.sin(x)/x) > > The function works correctly r

Re: [Numpy-discussion] runtime warning for where

2013-11-16 Thread alex
On Sat, Nov 16, 2013 at 8:28 AM, David Pine wrote: > The program at the bottom of this message returns the following runtime > warning: > > python test.py > test.py:5: RuntimeWarning: invalid value encountered in divide > return np.where(x==0., 1., np.sin(x)/x) > > The function works correctly r

[Numpy-discussion] runtime warning for where

2013-11-16 Thread David Pine
The program at the bottom of this message returns the following runtime warning: python test.py test.py:5: RuntimeWarning: invalid value encountered in divide return np.where(x==0., 1., np.sin(x)/x) The function works correctly returning x = np.array([ 0., 1., 2., 3., 4., 5., 6.,