[Numpy-discussion] Min Error
David Reed
david.reed.c at gmail.com
Sun Sep 22 10:54:31 EDT 2013
Sebastian,
I apologize, that did work. I forgot to autoreload. Can you explain why
the original code did work at the debug prompt?
-Dave
On Sun, Sep 22, 2013 at 10:45 AM, David Reed <david.reed.c at gmail.com> wrote:
> Thanks Sebastian, but still have same error. Also doesn't explain why it
> works when I run the same code at the debug prompt. Scratching my head on
> this one.
>
> Dave
>
>
> On Sun, Sep 22, 2013 at 10:42 AM, Sebastian Berg <
> sebastian at sipsolutions.net> wrote:
>
>> 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
>>
>>
>> _______________________________________________
>> NumPy-Discussion mailing list
>> NumPy-Discussion at scipy.org
>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20130922/54db9b4e/attachment.html>
More information about the NumPy-Discussion
mailing list