[Numpy-discussion] Nonblocking Plots with Matplotlib
Wed Mar 14 17:47:22 CDT 2007
Thanks, Sebastian. I'll take a look at Pyro. Hadn't heard of it.
I'm using just xmlrpclib with pickle right now.
On 3/15/07, Sebastian Haase <email@example.com> wrote:
> Hey Bill,
> what are you using to communicate with the server ?
> May I recommend looking at Pyro !
> (Python remote objects)
> It would allow you to get your proxy objects.
> And also handles exception super clean and easy.
> I have used it for many years ! It's very stable !
> (If you run into problems, take a look at the "one-way" calls to
> ensure that functions, that would block, won't wait for the function
> to return)
> Just a thought --
> -Sebastian Haase
> On 3/13/07, Bill Baxter <firstname.lastname@example.org> wrote:
> > Howdy Folks,
> > I was missing the good ole days of using Matlab back at the Uni when I
> > could debug my code, stop at breakpoints and plot various data without
> > fear of blocking the interpreter process.
> > Using "ipython -pylab" is what has been suggested to me in the past,
> > but the problem is I don't do my debugging from ipython. I have a
> > very nice IDE that works very well, and it has a lovely interactive
> > debugging prompt that I can use to probe my code when stopped at a
> > breakpoint. It's great except I can't really use matplotlib for
> > debugging there because it causes things to freeze up.
> > So I've come up with a decent (though not perfect) solution for
> > quickie interactive plots which is to run matplotlib in a separate
> > process. I call the result it 'ezplot'. The first alpha version of
> > this is now available at the Cheeseshop. (I made an egg too, so if
> > you have setuptools you can do "easy_install ezplot".)
> > The basic usage is like so:
> > In : import ezplot
> > In : p = ezplot.Plotter()
> > In : p.plot([1,2,3],[1,4,9],marker='o')
> > Connecting to server... waiting...
> > connected to plotserver 0.1.0a1 on http://localhost:8397
> > Out: True
> > In : from numpy import *
> > In : x = linspace(-5,5,20)
> > In : p.clf()
> > Out: True
> > In : p.plot(x, x*x*log(x*x+0.01))
> > (Imagine lovely plots popping up on your screen as these commands are typed.)
> > The only return values you get back are True (success...probably) or
> > False (failure...for sure). So no fancy plot object manipulation is
> > possible. But you can do basic plots no problem.
> > The nice part is that this (unlike ipython's built-in -pylab threading
> > mojo) should work just as well from wherever you're using python.
> > Whether it's ipython (no -pylab) or Idle, or a plain MS-DOS console,
> > or WingIDE's debug probe, or SPE, or a PyCrust shell or whatever. It
> > doesn't matter because all the client is doing is packing up data and
> > shipping over a socket. All the GUI plotting mojo happens in a
> > completely separate process.
> > There are plenty of ways this could be made better, but for me, for
> > now, this probably does pretty much all I need, so it's back to Real
> > Work. But if anyone is interested in making improvements to this, let
> > me know.
> > Here's a short list of things that could be improved:
> > * Right now I assume use of the wxAGG backend for matplotlib. Don't
> > know how much work it would be to support other back ends (or how to
> > go about it, really). wxAGG is what I always use.
> > * Returning more error/exception info from the server would be nice
> > * Returning full fledged proxy plot objects would be nice too, but I
> > suspect that's a huge effort
> > * SOAP may be better for this than xmlrpclib but I just couldn't get
> > it to work (SOAPpy + Twisted).
> > * A little more safety would be nice. Anyone know how to make a
> > Twisted xmlrpc server not accept connections from anywhere except
> > localhost?
> > * There's a little glitch in that the spawned plot server dies with
> > the parent that created it. Maybe there's a flag to subprocess.Popen
> > to fix that?
> > * Sometimes when you click on "Exit Server", if there are plot windows
> > open it hangs while shutting down.
> > Only tested on Win32 but there's nothing much platform specific in there.
> > Give it a try and let me know what you think!
> > --bb
> > _______________________________________________
> > Numpy-discussion mailing list
> > Numpyemail@example.com
> > http://projects.scipy.org/mailman/listinfo/numpy-discussion
> Numpy-discussion mailing list
More information about the Numpy-discussion