I would write down an MPL script that loads a block data, generated on the
fly (in a file) by another computing program, at a regular time rate, let's
say every 30". The script may have an "exit button" to stop it, and it might
proceed this way:
1. time = time_old
2. Load the "data" from lines 0 to -1(EOF)
3. Save "data" length: N = len(data)
4. plot
5. After time_new-time_old = time_step
5a. load "data_tmp" from lines N to -1
5b. extend "data" with "data_tmp"
5c. plot
5d. Go back to step 5, or press "Stop" button
Does anyone have an idea how to encode this purpose?
I would write down an MPL script that loads a block data, generated on the
fly (in a file) by another computing program, at a regular time rate, let's
say every 30". The script may have an "exit button" to stop it, and it might
proceed this way:
1. time = time_old
2. Load the "data" from lines 0 to -1(EOF)
3. Save "data" length: N = len(data)
4. plot
5. After time_new-time_old = time_step
5a. load "data_tmp" from lines N to -1
5b. extend "data" with "data_tmp"
5c. plot
5d. Go back to step 5, or press "Stop" button
Does anyone have an idea how to encode this purpose?
I don't really understand what the problem is. If you don't you know how
to wait a definite time between loading the file, have a look at the
time module:
especially time.sleep()
m.
···
--
Massimo Sandal
University of Bologna
Department of Biochemistry "G.Moruzzi"
I would venture a guess that the problem is how to update the plot.
I have not investigated this problem, but I have a hard time figuring
out how matplotlib deals with updating plots after plot.show() has
been called to plot to the screen the first time.
Cheers
Tommy
···
On Oct 10, 2007, at 12:53 PM, massimo sandal wrote:
sidimok ha scritto:
I would write down an MPL script that loads a block data, generated on the
fly (in a file) by another computing program, at a regular time rate, let's
say every 30". The script may have an "exit button" to stop it, and it might
proceed this way:
1. time = time_old
2. Load the "data" from lines 0 to -1(EOF)
3. Save "data" length: N = len(data)
4. plot
5. After time_new-time_old = time_step
5a. load "data_tmp" from lines N to -1
5b. extend "data" with "data_tmp"
5c. plot
5d. Go back to step 5, or press "Stop" button
Does anyone have an idea how to encode this purpose?
I don't really understand what the problem is. If you don't you know how
to wait a definite time between loading the file, have a look at the
time module:
I would venture a guess that the problem is how to update the plot.
There are issues with calling Show() more than once - you may be able to set the interactive mode and get it to work.
the other option is to write a very simple app with a GUI toolkit -- see the embedding in ** examples.
If you want to do wxPython, you can use wxmpl to wrap MPL, and building a little app with wxTimer and a stop button would be really easy.
-Chris
···
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception