mpl and numpy ma branch

Hi,

calling show returns the following error using the numpy maskedarray branch. The figure is a quiver plot on a basemap instance.

/usr/local/lib64/python2.5/site-packages/matplotlib/figure.pyc in draw(self, renderer)

696
697         # render the axes

–> 698 for a in self.axes: a.draw(renderer)
699
700 # render the figure text

/usr/local/lib64/python2.5/site-packages/matplotlib/axes.pyc in draw(self, renderer, inframe)

1396
1397 for zorder, i, a in dsu:
-> 1398 a.draw(renderer)
1399
1400 renderer.close_group(‘axes’)

/usr/local/lib64/python2.5/site-packages/matplotlib/quiver.pyc in draw(self, renderer)

335         if self._new_UV:
336             verts = self._make_verts(self.U, self.V)

–> 337 self.set_verts(verts)
338 self._new_UV = False
339 collections.PolyCollection.draw
(self, renderer)

/usr/local/lib64/python2.5/site-packages/matplotlib/collections.pyc in set_verts(self, verts)
479 def set_verts(self, verts):
480 ‘’‘This allows one to delay initialization of the vertices.’’’

–> 481 self._paths = [mpath.Path(v) for v in verts]
482
483 def get_paths(self):

/usr/local/lib64/python2.5/site-packages/matplotlib/path.pyc in init(self, vertices, codes)
118 len(vertices), self.code_type)
119 codes[0] = self.MOVETO
–> 120 vertices = ma.compress(npy.invert(mask1d), vertices, 0)
121 vertices = npy.asarray(vertices)
122 codes = npy.where(npy.concatenate((mask1d[-1:], mask1d[:-1])),

AttributeError: ‘module’ object has no attribute ‘compress’

Cheers,

David

David Huard wrote:

Hi,

calling show returns the following error using the numpy maskedarray branch. The figure is a quiver plot on a basemap instance.

I haven't personally done any testing with the maskedarray branch myself, though I know Eric Firing has done a little.

/usr/local/lib64/python2.5/site-packages/matplotlib/path.pyc in __init__(self, vertices, codes)
    118 len(vertices), self.code_type)
    119 codes[0] = self.MOVETO
--> 120 vertices = ma.compress(npy.invert(mask1d), vertices, 0)
    121 vertices = npy.asarray(vertices)
    122 codes = npy.where(npy.concatenate((mask1d[-1:], mask1d[:-1])),

AttributeError: 'module' object has no attribute 'compress'

This seems to work if you change it to npy.compress -- for both the "default" ma and the maskedarray branch. I'll go ahead and commit this change, though there may be performance implications.

Cheers,
Mike

···

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

Michael Droettboom wrote:

David Huard wrote:

Hi,

calling show returns the following error using the numpy maskedarray branch. The figure is a quiver plot on a basemap instance.

I haven't personally done any testing with the maskedarray branch myself, though I know Eric Firing has done a little.

I'm using it routinely, but have not been doing any great variety of plots. I might have hit that bug a few days ago, but if I did I worked around it instead of investigating.

/usr/local/lib64/python2.5/site-packages/matplotlib/path.pyc in __init__(self, vertices, codes)
    118 len(vertices), self.code_type)
    119 codes[0] = self.MOVETO
--> 120 vertices = ma.compress(npy.invert(mask1d), vertices, 0)
    121 vertices = npy.asarray(vertices)
    122 codes = npy.where(npy.concatenate((mask1d[-1:], mask1d[:-1])),

AttributeError: 'module' object has no attribute 'compress'

I reported the absence, and Stefan van der Walt has already put a version in svn.

The whole block of code can be streamlined and sped up a bit; I will commit a change to do that.

Eric

I wonder if Eric's changes (which are quite different) fix David's scalar mask problem...?

Cheers,
Mike

Eric Firing wrote:

···

Michael Droettboom wrote:

David Huard wrote:

Hi,

calling show returns the following error using the numpy maskedarray branch. The figure is a quiver plot on a basemap instance.

I haven't personally done any testing with the maskedarray branch myself, though I know Eric Firing has done a little.

I'm using it routinely, but have not been doing any great variety of plots. I might have hit that bug a few days ago, but if I did I worked around it instead of investigating.

/usr/local/lib64/python2.5/site-packages/matplotlib/path.pyc in __init__(self, vertices, codes)
    118 len(vertices), self.code_type)
    119 codes[0] = self.MOVETO
--> 120 vertices = ma.compress(npy.invert(mask1d), vertices, 0)
    121 vertices = npy.asarray(vertices)
    122 codes = npy.where(npy.concatenate((mask1d[-1:], mask1d[:-1])),

AttributeError: 'module' object has no attribute 'compress'

I reported the absence, and Stefan van der Walt has already put a version in svn.

The whole block of code can be streamlined and sped up a bit; I will commit a change to do that.

Eric

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA