|
From: Darren D. <dar...@co...> - 2008-05-27 20:57:16
|
On the trunk, the following script will show an image but will not rescale it: im=imshow(rand(10,10)) im.set_clim(0,0.2) draw() It works on the maintenance branch. |
|
From: John H. <jd...@gm...> - 2008-05-27 21:22:04
|
On Tue, May 27, 2008 at 3:55 PM, Darren Dale <dar...@co...> wrote:
> On the trunk, the following script will show an image but will not rescale it:
>
> im=imshow(rand(10,10))
> im.set_clim(0,0.2)
> draw()
I see that too -- and another image related bug:
In [177]: imshow(rand(10,10))
Out[177]: <matplotlib.image.AxesImage object at 0x1003acec>
In [178]: hot()
Traceback (most recent call last):
File "<ipython console>", line 1, in ?
File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/pyplot.py",
line 2305, in hot
draw_if_interactive()
File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/backends/backend_tkagg.py",
line 58, in draw_if_interactive
figManager.show()
File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/backends/backend_tkagg.py",
line 338, in show
self.canvas.draw()
File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/backends/backend_tkagg.py",
line 191, in draw
FigureCanvasAgg.draw(self)
File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/backends/backend_agg.py",
line 255, in draw
self.figure.draw(self.renderer)
File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/figure.py",
line 792, in draw
for a in self.axes: a.draw(renderer)
File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/axes.py",
line 1394, in draw
im.draw(renderer)
File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/image.py",
line 226, in draw
im = self.make_image(renderer.get_image_magnification())
File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/image.py",
line 182, in make_image
im.is_grayscale = self.cmap.is_gray()
File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/colors.py",
line 504, in is_gray
return (np.alltrue(self._lut[:,0] == self._lut[:,1])
AttributeError: LinearSegmentedColormap instance has no attribute '_lut'
I thought at first all I would need to do is add an _init call in is_gray:
def is_gray(self):
if not self._isinit: self._init()
return (np.alltrue(self._lut[:,0] == self._lut[:,1])
and np.alltrue(self._lut[:,0] == self._lut[:,2]))
which does indeed stop the exception but there is the same problem you
point to: the image is not updated. I don't have time to drill into
this one right now, but they are probably the same bug. I'm
committing the is_gray lut bugfix and punting on the deeper bug for
now.
|
|
From: Darren D. <dar...@co...> - 2008-05-27 22:44:32
|
On Tuesday 27 May 2008 5:22:00 pm John Hunter wrote: > On Tue, May 27, 2008 at 3:55 PM, Darren Dale <dar...@co...> wrote: > > On the trunk, the following script will show an image but will not > > rescale it: > > > > im=imshow(rand(10,10)) > > im.set_clim(0,0.2) > > draw() > > I see that too -- and another image related bug: [...] > which does indeed stop the exception but there is the same problem you > point to: the image is not updated. I don't have time to drill into > this one right now, but they are probably the same bug. I'm > committing the is_gray lut bugfix and punting on the deeper bug for > now. It truns out this was introduced a while back, in commit 5042. Eric, according to the changelog you were working on speeding up panning and zooming of dense images, do you have time to revisit it? Darren |
|
From: Eric F. <ef...@ha...> - 2008-05-27 23:40:41
|
On Tue, 2008-05-27 at 18:44 -0400, Darren Dale wrote: > On Tuesday 27 May 2008 5:22:00 pm John Hunter wrote: > > On Tue, May 27, 2008 at 3:55 PM, Darren Dale <dar...@co...> > wrote: > > > On the trunk, the following script will show an image but will not > > > rescale it: > > > > > > im=imshow(rand(10,10)) > > > im.set_clim(0,0.2) > > > draw() > > > > I see that too -- and another image related bug: > [...] > > which does indeed stop the exception but there is the same problem you > > point to: the image is not updated. I don't have time to drill into > > this one right now, but they are probably the same bug. I'm > > committing the is_gray lut bugfix and punting on the deeper bug for > > now. > > It truns out this was introduced a while back, in commit 5042. Eric, according > to the changelog you were working on speeding up panning and zooming of dense > images, do you have time to revisit it? If I fouled it up--as evidently I did--I would like to fix it. I will take a first look at it this evening. Eric > > Darren |
|
From: John H. <jd...@gm...> - 2008-05-28 02:05:38
|
On Tue, May 27, 2008 at 6:40 PM, Eric Firing <ef...@ha...> wrote: > If I fouled it up--as evidently I did--I would like to fix it. I will > take a first look at it this evening. FYI, this bug is only exposed in interactive use since the caching is triggered by the first draw. The problem is with the image.AxesImage._rgbacache -- it is not being cleared with a set_clim or a set_cmap. I am going to commit a preliminary fix which simply resets this on any call to image.AxesImage.changed and if there is a better place to do the reset vis-a-vis the optimization you are trying to capture, please modify as necessary. JDH |
|
From: Eric F. <ef...@ha...> - 2008-05-28 07:05:13
|
John Hunter wrote: > The problem is with the image.AxesImage._rgbacache -- it is not being > cleared with a set_clim or a set_cmap. I am going to commit a > preliminary fix which simply resets this on any call to > image.AxesImage.changed and if there is a better place to do the reset > vis-a-vis the optimization you are trying to capture, please modify as > necessary. John, As far as I can see, you found the right solution. I don't think it interferes in any way with the optimizations. Thank you. Eric > > JDH |