[SciPy-user] Flicker image plotting

eric eric at scipy.org
Tue Feb 26 14:00:50 EST 2002


Hey Andrew,

I think this problem has been addressed.  What version of SciPy are you using?
I'm not sure it is completely cured, but the example you give does produce the
expected 10 vertical alternating black and white stripes in my version of SciPy
(from the CVS about 2 days ago).

eric


----- Original Message -----
From: "Andrew M. Henshaw" <andrew.henshaw at mail.com>
To: <scipy-user at scipy.org>
Sent: Tuesday, February 26, 2002 12:13 AM
Subject: RE: [SciPy-user] Flicker image plotting


> I have modded the wxplt code, as you suggested.  There is another source of
flicker - the plt.image call eventually invalidates the window with a clear
background option set.  I've added a "reimage" command that satisfies my
requirements; I don't know if this is the best way to handle the issue.
>
> However, I have a bit of a side-related problem with the image plotting.  I'm
testing without my patches, so I don't believe the error is in anything that
I've added.  I've distilled the problem down to a small bit of code, which
follows.
>
> ##########
> import gui_thread
> from Numeric import *
> from scipy import plt
>
> plt.xaxis('fit')
> plt.yaxis('fit')
>
> numsmp = 32
> rgates = 10
> A      = zeros((numsmp, rgates), 'double')
>
> for i in range(0, rgates, 2):
>     A[:, i] = ones(numsmp, 'double')
> plt.image(A, scale='yes')
> raw_input()
> plt.close()
>
> Basically, I thought the code would create and display 10 columns of
alternating black and white stripes (with length of 32).  It seems to display 32
alternating stripes of length 32.  If I transpose the array before plotting,
then I get the 10 stripes, but they are stair-stepped and don't run strictly
east-to-west.  Anything wrong with this code?  Is this a reproducible problem
for anyone else?
>
>
>
> -----Original Message-----
> From: scipy-user-admin at scipy.org [mailto:scipy-user-admin at scipy.org]On
> Behalf Of eric
> Sent: Saturday, February 23, 2002 3:23 PM
> To: scipy-user at scipy.org
> Subject: Re: [SciPy-user] Flicker image plotting
>
>
> I'm guessing you can just change the plot_canvas.draw method around line 403
in
> scipy/plt/wxplt to use a MemoryDC instead of the client DC.
>
> Here is the method.
>
>    def draw(self,dc=None):
>         #if not len(self.line_list) or len(self.image_list):
>         #    return
>         # resize if necessary
>         #print 'draw'
>         t1 = time.clock();self.reset_size(dc);t2 = time.clock()
>         #print 'resize:',t2 - t1
>         if not dc: dc = wx.wxClientDC(self)
>         # draw titles and axes labels
>         t1 = time.clock()
>         for text in self.all_titles:
>             text.draw(dc)
>         for axis in self.axes:
>             axis.draw_labels(dc)
>         t2 = time.clock()
>         #print 'text:',t2 - t1
>         self.draw_graph_area(dc)
>
> Take note that the plotting effort will resume in a different direction very
> soon.  However, I expect wxplt will still be around for a while, so, if it
> doesn't take much effort, it is a worthwhile addition.
>
> eric
>
> ----- Original Message -----
> From: "Andrew M. Henshaw" <andrew.henshaw at mail.com>
> To: <scipy-user at scipy.org>
> Sent: Saturday, February 23, 2002 4:01 PM
> Subject: RE: [SciPy-user] Flicker image plotting
>
>
> > I'll look at this.  I've done this before with a few Win32-based programs,
but
> I didn't want to go off on a wild goose chase, if it was already implemented.
> >
> > Thanks to both of you.
> >
> > Andy
> >
> > -----Original Message-----
> > From: scipy-user-admin at scipy.org [mailto:scipy-user-admin at scipy.org]On
> > Behalf Of eric
> > Sent: Saturday, February 23, 2002 1:29 PM
> > To: scipy-user at scipy.org
> > Subject: Re: [SciPy-user] Flicker image plotting
> >
> >
> > Hey Andrew,
> >
> > I haven't looked at this, but bet you could use the trick Bryan suggests.
> > However, wxplt started with real-time plotting in mind, but that quickly
fell
> by
> > the way side.  As such, I doubt the frame rate will be so hot.
> >
> > Still, it might be worth trying because Bryan's suggestion isn't that hard
to
> > implement.  If someone ends up with a patch, send it my way and I'll take a
> look
> > at adding it to the distribution.
> >
> > see ya,
> > eric
> >
> > > I'm not sure how much effort would be to fix this in SciPy as I don't
> > > use SciPy much, but I have modified the wxPlotCanvas which comes with
> > > wxPython, to be flicker-free (plus a few other mods). I use this for
> > > real-time data display (line plots and colour-maps).
> > >
> > >  You simply draw everything to a an image held in memory (a MemoryDC)
> > > then copy this to the screen (with the Blit function - very fast).
> > >
> > > Bryan
> > >
> > >
> > >
> > > On Sat, 2002-02-23 at 02:26, Andrew M. Henshaw wrote:
> > > > Is there some mechanism for double-buffering image plots so that they
> don't
> > flicker when a series of image arrays is generated?
> > > > _______________________________________________
> > > > SciPy-user mailing list
> > > > SciPy-user at scipy.net
> > > > http://www.scipy.net/mailman/listinfo/scipy-user
> > > --
> > > Bryan Cole
> > > Teraview Ltd., 302-304 Cambridge Science Park, Milton Road, Cambridge
> > > CB4 0WG, United Kingdom.
> > > tel: +44 (1223) 435380 / 435386 (direct-dial) fax: +44 (1223) 435382
> > >
> > > _______________________________________________
> > > SciPy-user mailing list
> > > SciPy-user at scipy.net
> > > http://www.scipy.net/mailman/listinfo/scipy-user
> > >
> >
> >
> > _______________________________________________
> > SciPy-user mailing list
> > SciPy-user at scipy.net
> > http://www.scipy.net/mailman/listinfo/scipy-user
> > _______________________________________________
> > SciPy-user mailing list
> > SciPy-user at scipy.net
> > http://www.scipy.net/mailman/listinfo/scipy-user
> >
>
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user
>





More information about the SciPy-User mailing list