[Numpy-discussion] Is this a bug in numpy.ma.reduce?

David Goldsmith d.l.goldsmith at gmail.com
Fri Mar 5 13:05:51 EST 2010


On Fri, Mar 5, 2010 at 9:43 AM, David Goldsmith <d.l.goldsmith at gmail.com>wrote:

> On Fri, Mar 5, 2010 at 9:22 AM, David Goldsmith <d.l.goldsmith at gmail.com>wrote:
>
>> On Fri, Mar 5, 2010 at 2:51 AM, Pierre GM <pgmdevlist at gmail.com> wrote:
>>
>>> On Mar 5, 2010, at 4:38 AM, David Goldsmith wrote:
>>> > Hi!  Sorry for the cross-post, but my own investigation has led me to
>>> suspect that mine is actually a numpy problem, not a matplotlib problem.
>>>  I'm getting the following traceback from a call to matplotlib.imshow:
>>> > ...
>>> > Based on examination of the code, the last self is an instance of
>>> ma._extrema_operation (or one of its subclasses) - is there a reason why
>>> this class is unable to deal with a "zero-size array to ufunc.reduce without
>>> identity," (i.e., was it thought that it would - or should - never get one)
>>> or was this merely an oversight?  Either way, there's other instances on the
>>> lists of this error cropping up, so this circumstance should probably be
>>> handled more robustly.  In the meantime, workaround?
>>>
>>>
>>> 'm'fraid no. I gonna have to investigate that. Please open a ticket with
>>> a self-contained example that reproduces the issue.
>>>
>>
>> I'll do my best, but since it's a call from matplotlib and I don't really
>> know what's causing the problem (other than a literal reading of the
>> exception) I'm not sure I can.
>>
>
> Well, that was easy:
>
> mn = N.ma.core._minimum_operation()
> mn.reduce(N.array(()))
>
> Traceback (most recent call last):
>   File "<input>", line 1, in <module>
>
>   File "C:\Python254\Lib\site-packages\numpy\ma\core.py", line 5570, in
> reduce
>     t = self.ufunc.reduce(target, **kargs)
> ValueError: zero-size array to ufunc.reduce without identity
>
> I'll file a ticket.
>

OK, Ticket #1422 filed.

DG
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20100305/a7ef905b/attachment.html>


More information about the NumPy-Discussion mailing list