[Numpy-discussion] Min Error

Sebastian Berg sebastian at sipsolutions.net
Sun Sep 22 10:42:26 EDT 2013


On Sun, 2013-09-22 at 10:21 -0400, David Reed wrote:
> Hi, 
> 
> 
> I am getting  a strange error when finding the minimum of a matrix.
>  The weird thing is I get this while running within iPython shell, and
> if I do %debug and go to the line where this fails and run the command
> `a = np.min(D, axis=0)`, I get no error.
> 
> 
> Here is the trace:
> 
> 
> draw_lines/main.pyc in haus_distance(A, B)
>      28         D = D.reshape((len(A), None))
>      29 
> ---> 30         a = np.min(D, axis=0)
>      31 
>      32         # vp = np.max(np.min(D, axis=0))
> 

There is an error in the reshape code. The real error is the None in
your reshape right above, it should be -1.
This is not surfaced correctly due to a bug in Reshape, but instead gets
surfaced (somewhat randomly) lateron.

- Sebastian

> 
> anaconda/lib/python2.7/site-packages/numpy/core/fromnumeric.pyc in
> amin(a, axis, out, keepdims)
>    1985     else:
>    1986         return _methods._amin(a, axis=axis,
> -> 1987                             out=out, keepdims=keepdims)
>    1988 
>    1989 def alen(a):
> 
> 
> anaconda/lib/python2.7/site-packages/numpy/core/_methods.pyc in
> _amin(a, axis, out, keepdims)
>      12 def _amin(a, axis=None, out=None, keepdims=False):
>      13     return um.minimum.reduce(a, axis=axis,
> ---> 14                             out=out, keepdims=keepdims)
>      15 
>      16 def _sum(a, axis=None, dtype=None, out=None, keepdims=False):
> 
> 
> TypeError: an integer is required
> 
> 
> 
> 
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion





More information about the NumPy-Discussion mailing list