On Tue, Feb 26, 2008 at 5:26 PM, Christopher Burns <[EMAIL PROTECTED]> wrote: > If I initialize an AxesImage using a np.zeros array and then set the > axes data later to a np.memmap array, I get a RuntimeError when > matplotlib tries to autoscale the image. The errors continue to fill > my console and I'm forced to close the shell. This bug was introduced > when I switched from numpy v1.0.3.1 to the trunk v1.0.5.dev4815 > > The two hacks to get around this are: > 1) Setting any array element to something other than zero fixes the error: > zdata[0,0] = 1 > 2) Specify the extent and max/min values when creating the image: > imgaxes = pylab.imshow(zdata, extent=(0, data_shape[1], > data_shape[0], 0), vmin=0, vmax=1) > > Unfortunately, due to the way this errors I'm having a difficult time > debugging it. I'm hoping someone with in-depth knowledge of > masked_arrays will have some insight.
> Exception exceptions.AttributeError: "'memmap' object has no attribute > '_mmap'" in <bound method memmap.__del__ of memmap([ 0., 0., 0., > 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., > 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., > 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., > 0., 0.])> ignored Some operations on numpy.memmap objects create new arrays, but unfortunately, the new array objects, which should be ndarrays, are created as numpy.memmap instances even though they aren't. When they go to clean up after themselves, they fail. A workaround would be to make numpy.memmap.__del__ more robust and do nothing if ._mmap isn't present. A real fix would be to figure out how to make sure that "memmap+memmap", etc., make ndarray instances rather than memmap instances. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion