Update and replot data at a regular time rate

Hi everyone!

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?

Thanks.

···

--
View this message in context: http://www.nabble.com/Update-and-replot-data-at-a-regular-time-rate-tf4600152.html#a13133808
Sent from the matplotlib - users mailing list archive at Nabble.com.

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:

http://docs.python.org/lib/module-time.html

especially time.sleep()

m.

···

--
Massimo Sandal
University of Bologna
Department of Biochemistry "G.Moruzzi"

snail mail:
Via Irnerio 48, 40126 Bologna, Italy

email:
massimo.sandal@...898...

tel: +39-051-2094388
fax: +39-051-2094387

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:

http://docs.python.org/lib/module-time.html

especially time.sleep()

m.

I would venture a guess that the problem is how to update the plot.

That's it!

···

--
View this message in context: http://www.nabble.com/Update-and-replot-data-at-a-regular-time-rate-tf4600152.html#a13141806
Sent from the matplotlib - users mailing list archive at Nabble.com.

sidimok wrote:

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

Chris.Barker@...259...