yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #05096
Re: live plot update during simulation
-
To:
yade-dev@xxxxxxxxxxxxxxxxxxx
-
From:
Janek Kozicki <janek_listy@xxxxx>
-
Date:
Tue, 6 Jul 2010 10:00:28 +0200
-
Face:
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAALVBMVEUBAQEtLS1KSkpRUVFXV1dYWFhjY2Nzc3N3d3eHh4eKioqdnZ24uLjLy8vc3NxVIagyAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH2AIVEzgS1fgQtQAAAjRJREFUOMtt1DFv00AUAOAzFQNbjigSyoQaRaBMhKgLUyKXpVNNeUpk9vyDqFJhQ1kiBuaqAwJCqvPtSLY7RlTn5+5IdnYkkt/AOyfxXVLe5vf53Z1875kd34tOEax8djmj6GyjhB5bxz50GdsVZr9fqRjZwAtKOJw5Wqs2MMZ16ALHsaDncF7xAHix1oEFHAB8f+pRjcO4gfZDykcYzbiucRolOLUJ6kjA0xtVt+A6TySlM0RajIpK6DzwKZ/nOYbF/gclHMo1ZOHYY/+Ha+AWuM+3oMS4eeqYzZ8FiCltgUqI8cd2wwAVpJk+8LWYjBtnJdQpHQqJMd4Oxt4bU9ESiFGc5hkqaH74asAX4iabP5I5gZ+qjgGlJCqZa3h3lxhoeVcSE1qLQC4sqKOK9MGW9E3izFqqHokoztLFEgXg31sbZEKnWi2T74A4NxfVQqlkjKtcAWD+zcArFEES01dR0E/nnV0IgugmDd/2L84sOAouRBBHEc7gtc8teDkRlE0iNQPo2w3Xhh/D4TCIQ4LRLoTvgwjj6RRgavdurxYGMaIuGOyAW/PpNlCcU9/93AHenAWYjPoAwa+G3e3to/MgFNTAEKvKDjzuCzHTnY3qqdXtx24VijzQfZ0yewZ5cwRFQaa+mIYr1uI0I76+3W4xhlvoVRwOA0Fdl64HlJnxP6T8YpX/Lga4Wv4A3ErrU5oTfN7Mu/llXMl8RXEPji/lQkN3H7qXqgC2By47EXeU/7PJ/wPxRKMnuZwIeAAAAABJRU5ErkJggg==
-
In-reply-to:
<1278401961.1576.25.camel@flux>
Václav Šmilauer said: (by the date of Tue, 06 Jul 2010 09:39:21 +0200)
> What is this funny thing? :-)
>
> > + thread.start_new_thread(livePlotLoop,(1,2))
> > +
> > +
> > +def livePlotLoop(dummy1,dummy2):
>
>
> Did you read the tutorial section
> http://docs.python.org/tutorial/datastructures.html#tuples-and-sequences
> paragraph starting "A special problem is the construction of tuples
> containing 0 or 1 items"?
hehe, not yet. I am learning by trial & error, google and skimming
this tutorial. So far I have read about 5% of that tutorial ;-))
aha! so it should be () instead of (1,2)
> Hi Janek, this is a great feature, I tried several times and it never
> worked properly. If you notices, the first call to plot.plot() is
> blocking (till you close those plots), while the next ones are not; I
> suspect that this is exactly the issue.
yes, the first call is blocking because of pylab.show().
I found it by trial and error :) In fact I don't know why
pylab.show() is called, because even without it the figure() appears
on the screen.
I made it more apparent in my second diff with livePlotInit parameter.
> A problem is that matplotlib has several backends (Tk, Gtk, Wx) and they
> sould be all supported -- let's see. Another problem is that a a LOT of
> code is duplicated, and it is code that is not easy to read and can be
> buggy.
>
> Thanks for your contribution, I will try to fix that and merge plot with
> liveplot etc. so that the code is readable.
there's in fact a lot to fix. The biggest problem for me is using
TMP_data. That *sum(..) line is plain magic for me, and I totally
don't understand it. And currently my code works only for uniax.py
but I couldn't get it to work with any other script that does
plotting.
Maybe you could, erm, rewrite that magic line into something longer
that is easier to read and find bugs?
> mtTkinter can be added locally to yade, no problem.
I would like to know how you added it lcoally :) I will read your commits.
Especially that part in which I had to use root access to
edit /usr/lib/pymodules/python2.6/matplotlib/backends/tkagg.py
btw, that is its homepage:
http://tkinter.unpythonic.net/wiki/mtTkinter
best regards
--
Janek Kozicki http://janek.kozicki.pl/ |
Follow ups
References