[Python-modules-team] Bug#573179: "AttributeError: 'numpy.bool_' object has no attribute '_mask'" whenever imshow'ing masked array

Yaroslav Halchenko debian at onerussian.com
Tue Mar 9 16:05:39 UTC 2010


Package: python-matplotlib
Version: 0.99.1.2-3
Severity: normal


throws an exception while comparing two masked arrays which have no values (all
masked out)... sure thing it can't determine vmin/vmax to be used (unless clim
is used explicitely), but the exception which is thrown is non-informative.  I
thought that upstream might want to make it more user-friendly -- please
forward upstream.  

Here is the code to reproduce:
import pylab as pl
import numpy as np

size = (5, 5)
d = np.ones(size)
mask = d.astype(bool)

md = np.ma.masked_array(d, mask)
pl.imshow(md)
# explicit  clim would eliminate the problem
#pl.clim(0, 1)
pl.colorbar()

and here is the traceback:

Traceback (most recent call last):
  File "/usr/lib/python2.5/lib-tk/Tkinter.py", line 1417, in __call__
    return self.func(*args)
  File "/usr/lib/pymodules/python2.5/matplotlib/backends/backend_tkagg.py", line 212, in resize
    self.show()
  File "/usr/lib/pymodules/python2.5/matplotlib/backends/backend_tkagg.py", line 215, in draw
    FigureCanvasAgg.draw(self)
  File "/usr/lib/pymodules/python2.5/matplotlib/backends/backend_agg.py", line 314, in draw
    self.figure.draw(self.renderer)
  File "/usr/lib/pymodules/python2.5/matplotlib/artist.py", line 46, in draw_wrapper
    draw(artist, renderer, *kl)
  File "/usr/lib/pymodules/python2.5/matplotlib/figure.py", line 773, in draw
    for a in self.axes: a.draw(renderer)
  File "/usr/lib/pymodules/python2.5/matplotlib/artist.py", line 46, in draw_wrapper
    draw(artist, renderer, *kl)
  File "/usr/lib/pymodules/python2.5/matplotlib/axes.py", line 1701, in draw
    im.draw(renderer)
  File "/usr/lib/pymodules/python2.5/matplotlib/artist.py", line 46, in draw_wrapper
    draw(artist, renderer, *kl)
  File "/usr/lib/pymodules/python2.5/matplotlib/image.py", line 237, in draw
    im = self.make_image(renderer.get_image_magnification())
  File "/usr/lib/pymodules/python2.5/matplotlib/image.py", line 182, in make_image
    x = self.to_rgba(self._A, self._alpha)
  File "/usr/lib/pymodules/python2.5/matplotlib/cm.py", line 166, in to_rgba
    x = self.norm(x)
  File "/usr/lib/pymodules/python2.5/matplotlib/colors.py", line 763, in __call__
    elif vmin==vmax:
  File "/usr/lib/python2.5/site-packages/numpy/ma/core.py", line 3119, in __eq__
    check._mask = mask
AttributeError: 'numpy.bool_' object has no attribute '_mask'






-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (901, 'unstable'), (900, 'testing'), (300, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.31-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages python-matplotlib depends on:
ii  libatk1.0-0             1.28.0-1         The ATK accessibility toolkit
ii  libc6                   2.10.2-5         Embedded GNU C Library: Shared lib
ii  libcairo2               1.8.8-2          The Cairo 2D vector graphics libra
ii  libfontconfig1          2.8.0-2          generic font configuration library
ii  libfreetype6            2.3.11-1         FreeType 2 font engine, shared lib
ii  libgcc1                 1:4.4.2-2        GCC support library
ii  libglib2.0-0            2.22.4-1         The GLib library of C routines
ii  libgtk2.0-0             2.18.6-1         The GTK+ graphical user interface 
ii  libpango1.0-0           1.26.0-1         Layout and rendering of internatio
ii  libpng12-0              1.2.40-1         PNG library - runtime
ii  libstdc++6              4.4.2-2          The GNU Standard C++ Library v3
ii  python                  2.5.4-9          An interactive high-level object-o
ii  python-cairo            1.8.6-1          Python bindings for the Cairo vect
ii  python-dateutil         1.4.1-3          powerful extensions to the standar
ii  python-gobject          2.16.1-1         Python bindings for the GObject li
ii  python-matplotlib-data  0.99.1.2-3       Python based plotting system (data
ii  python-numpy            1:1.3.0-3+b1     Numerical Python adds a fast array
ii  python-pyparsing        1.5.2-1          Python parsing module
ii  python-support          1.0.6.1          automated rebuilding support for P
ii  python-tz               2009l-1          Python version of the Olson timezo
ii  tcl8.5                  8.5.7-1          Tcl (the Tool Command Language) v8
ii  tk8.5                   8.5.7-1          Tk toolkit for Tcl and X11, v8.5 -
ii  zlib1g                  1:1.2.3.4.dfsg-3 compression library - runtime

Versions of packages python-matplotlib recommends:
ii  python-glade2                 2.16.0-1   GTK+ bindings: Glade support
ii  python-tk                     2.5.2-1.1  Tkinter - Writing Tk applications 

Versions of packages python-matplotlib suggests:
ii  dvipng                    1.11-1         convert DVI files to PNG graphics
ii  ipython                   0.10-1         enhanced interactive Python shell
ii  librsvg2-common           2.26.0-1       SAX-based renderer library for SVG
ii  python-configobj          4.5.2-2        a simple but powerful config file 
pn  python-excelerator        <none>         (no description available)
ii  python-gtk2               2.16.0-1       Python bindings for the GTK+ widge
ii  python-matplotlib-doc     0.99.0-1       Python based plotting system (docu
pn  python-qt3                <none>         (no description available)
ii  python-qt4                4.6-1          Python bindings for Qt4
ii  python-scipy              0.7.0-2+b1     scientific tools for Python
ii  python-traits             3.2.0-1        Manifest typing and reactive progr
ii  python-wxgtk2.8           2.8.10.1-3     wxWidgets Cross-platform C++ GUI t
ii  texlive-extra-utils       2007.dfsg.2-7  TeX Live: TeX auxiliary programs
ii  texlive-latex-extra       2007.dfsg.17-2 TeX Live: LaTeX supplementary pack

-- no debconf information





More information about the Python-modules-team mailing list