Re: [Numpy-discussion] min bug

2009-11-17 Thread Neil
Alan McIntyre alan.mcintyre at gmail.com writes:

 
 On Mon, Nov 16, 2009 at 11:34 PM, V. Armando Solé sole at esrf.fr wrote:
  Sebastian Berg wrote:
  Known issue, I think someone posted about it a while ago too. The numpy
  min is array aware, and it expects an array. The second argument is the
  axis, which in the case of a single number doesn't matter.
 
  I think I have to agree with the original poster.
 
  It would be more correct to rise an exception because the axis is beyond
  the number of axes than to return a confusing result.
 
 Hm, now that I actually try my example
 
 min((5000,), 4)
 
 it fails with an axis out of bounds error.  I presume there's a reason
 why a 0-D array gets special treatment?
 

In [16]: import numpy as np
In [17]: np.__version__ 
Out[17]: '1.4.0.dev7746'
In [18]: np.min(5000, 4)
...
ValueError: axis(=4) out of bounds


Neil

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] min bug

2009-11-16 Thread Chris
I'm pretty sure this shouldn't happen:

In [1]: from numpy import min

In [2]: min(5000, 4)
Out[2]: 5000


___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] min bug

2009-11-16 Thread Sebastian Berg
Known issue, I think someone posted about it a while ago too. The numpy
min is array aware, and it expects an array. The second argument is the
axis, which in the case of a single number doesn't matter.

On Tue, 2009-11-17 at 07:07 +, Chris wrote:
 I'm pretty sure this shouldn't happen:
 
 In [1]: from numpy import min
 
 In [2]: min(5000, 4)
 Out[2]: 5000
 
 
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion
 


___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] min bug

2009-11-16 Thread Alan McIntyre
On Mon, Nov 16, 2009 at 11:07 PM, Chris fonnesb...@gmail.com wrote:
 I'm pretty sure this shouldn't happen:

 In [1]: from numpy import min

 In [2]: min(5000, 4)
 Out[2]: 5000

The way you're calling it is working like this: min((5000,) , axis=4)
so you'd need to do this instead: min((5000,4))
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] min bug

2009-11-16 Thread V. Armando Solé
Sebastian Berg wrote:
 Known issue, I think someone posted about it a while ago too. The numpy
 min is array aware, and it expects an array. The second argument is the
 axis, which in the case of a single number doesn't matter.

 On Tue, 2009-11-17 at 07:07 +, Chris wrote:
   
 I'm pretty sure this shouldn't happen:

 In [1]: from numpy import min

 In [2]: min(5000, 4)
 Out[2]: 5000
 

I think I have to agree with the original poster.

It would be more correct to rise an exception because the axis is beyond 
the number of axes than to return a confusing result.

Armando

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] min bug

2009-11-16 Thread Alan McIntyre
On Mon, Nov 16, 2009 at 11:34 PM, V. Armando Solé s...@esrf.fr wrote:
 Sebastian Berg wrote:
 Known issue, I think someone posted about it a while ago too. The numpy
 min is array aware, and it expects an array. The second argument is the
 axis, which in the case of a single number doesn't matter.

 I think I have to agree with the original poster.

 It would be more correct to rise an exception because the axis is beyond
 the number of axes than to return a confusing result.

Hm, now that I actually try my example

min((5000,), 4)

it fails with an axis out of bounds error.  I presume there's a reason
why a 0-D array gets special treatment?
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion