472,328 Members | 1,750 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,328 software developers and data experts.

Real-time graphs

I've trolled the lists, FAQs, and Net as a whole, but
can't find anything definitive to answer this.

We're looking for real-time graph capability (bar,
line, etc), so that we can display telemetry from a
robot system. There are a bunch of packages out
there, but many seem to provide only static graphs
(e.g. for scientific, financial data, etc). Does
anyone currently display real-time telemetry using
Python? Can anyone provide any suggestions?

TIA
Stephen

Jul 18 '05 #1
12 9237
sn***********@yahoo.com wrote:
I've trolled the lists, FAQs, and Net as a whole, but
can't find anything definitive to answer this.

We're looking for real-time graph capability (bar,
line, etc), so that we can display telemetry from a
robot system. There are a bunch of packages out
there, but many seem to provide only static graphs
(e.g. for scientific, financial data, etc). Does
anyone currently display real-time telemetry using
Python? Can anyone provide any suggestions?


Unfortunately there is not anything designed specifically for
real-time graphs in python. You could create a custom control.

My suggestion is to use a Timer (like wx.Timer in wxpython) set to a
particular "frame rate" - how many times the graph should be refreshed
per second. Everytime it fires it updates the graph (if it is a
scrolling plot, or else if the data has changed). Meanwhile in a
background thread your time-stamped data points are collected, perhaps
into two lists. If it is a scrolling plot you could discard (or log)
data that is old.
Jul 18 '05 #2
This is pretty much my plan (or to use an observer pattern). But I was
wondering if anyone had used any particular graphing package to
generate these types of graphs? I wouldn't think that driving gnuplot
in the background would be an efficient approach, for example.

On May 12, 2004, at 1:20 PM, Doug Holton wrote:
sn***********@yahoo.com wrote:
I've trolled the lists, FAQs, and Net as a whole, but
can't find anything definitive to answer this.
We're looking for real-time graph capability (bar,
line, etc), so that we can display telemetry from a
robot system. There are a bunch of packages out
there, but many seem to provide only static graphs
(e.g. for scientific, financial data, etc). Does
anyone currently display real-time telemetry using
Python? Can anyone provide any suggestions?


Unfortunately there is not anything designed specifically for
real-time graphs in python. You could create a custom control.

My suggestion is to use a Timer (like wx.Timer in wxpython) set to a
particular "frame rate" - how many times the graph should be refreshed
per second. Everytime it fires it updates the graph (if it is a
scrolling plot, or else if the data has changed). Meanwhile in a
background thread your time-stamped data points are collected, perhaps
into two lists. If it is a scrolling plot you could discard (or log)
data that is old.
--
http://mail.python.org/mailman/listinfo/python-list

Jul 18 '05 #3

<sn***********@yahoo.com> wrote in message
news:ma**************************************@pyth on.org...
I've trolled the lists, FAQs, and Net as a whole, but
can't find anything definitive to answer this.

We're looking for real-time graph capability (bar,
line, etc), so that we can display telemetry from a
robot system. There are a bunch of packages out
there, but many seem to provide only static graphs
(e.g. for scientific, financial data, etc). Does
anyone currently display real-time telemetry using
Python? Can anyone provide any suggestions?

TIA
Stephen


You could make a Tkinter canvas and set it up to display the graph and
update it every second or however long you wish.
Jul 18 '05 #4
On Wed, 2004-05-12 at 22:12, Lucas Raab wrote:
<sn***********@yahoo.com> wrote in message
We're looking for real-time graph capability (bar,
line, etc), so that we can display telemetry from a
robot system. There are a bunch of packages out
there, but many seem to provide only static graphs
(e.g. for scientific, financial data, etc). Does
anyone currently display real-time telemetry using
Python? Can anyone provide any suggestions?


Give VPython a try, some of the examples use the graphing support.

--
David Watson
da***@planetwatson.co.uk

Jul 18 '05 #5
sn***********@yahoo.com wrote:

I've trolled the lists, FAQs, and Net as a whole, but
can't find anything definitive to answer this.

We're looking for real-time graph capability (bar,
line, etc), so that we can display telemetry from a
robot system. There are a bunch of packages out
there, but many seem to provide only static graphs
(e.g. for scientific, financial data, etc). Does
anyone currently display real-time telemetry using
Python? Can anyone provide any suggestions?


Here is something I wrote a few years ago that simulates a strip chart
recorder. Execute plotter.py; it will import from model.py.

Mitchell Timin

--
"Many are stubborn in pursuit of the path they have chosen, few in
pursuit of the goal." - Friedrich Nietzsche

http://annevolve.sourceforge.net is what I'm into nowadays.
# model.py - components for dynamic models
# by Mitchell Timin, 1999

from random import gauss

class delay:
"Pure time delay of a time sequence, like a tape loop"
def __init__(self, steps):
"initialize a new delaying object - argument is number of steps"
self.hist = []
for i in range(steps):
self.hist.append(0.0)
def lag(self, input):
" Object.lag(input) returns an earlier value of input."
self.hist.append(input)
return(self.hist.pop(0))

class generate:
def __init__(self):
self.X = 10.0
self.Y = 10.0
self.A = -0.2
self.B = -0.15
self.C = +0.12

def next(self):
dX = self.A*self.X + self.B*self.Y + gauss(0.0, .05)
dY = .4*self.X + self.C*self.Y
self.X = self.X + dX
self.Y = self.Y + dY
return(self.X, self.Y)

def modA(self, cont, oldcont):
self.A = self.A * (100 + cont - oldcont)/98.0
def modB(self, cont, oldcont):
self.B = self.B * (100 + cont - oldcont)/98.0
def modC(self, cont, oldcont):
self.C = self.C * (100 + cont - oldcont)/98.0

# Continuous plotting & control of a dynamic model
# by Mitchell Timin, 1999

# These are Python standard items:
from Tkinter import *
from time import sleep
from thread import start_new_thread, exit

# This is the dynamic model:
from model import generate
model = generate()

# This section sets up the graphics display and controls:
wide = 810 ; high = 560 # pixel dimensions of canvas
Halt = 0
def halt():
"used by PAUSE button to toggle Halt variable"
global Halt
if(Halt):
Halt = 0
else:
Halt = 1
root=Tk()
root.protocol("WM_DELETE_WINDOW", root.destroy)
frame = Frame(root)
frame.pack()
button = Button(frame, text="QUIT", fg="red", command=frame.quit)
button.pack(side=LEFT)
butt = Button(frame, text="PAUSE", fg="blue", command=halt)
butt.pack(side=LEFT)
but = Button(frame, text="RESTART", fg="green", command=model.__init__)
but.pack(side=LEFT)
scale = Scale(root)
scale.pack(side=LEFT)
scal = Scale(root)
scal.pack(side=LEFT)
sca = Scale(root)
sca.pack(side=LEFT)
canvas=Canvas(root,width=wide,height=high)
canvas.pack()

# A sequence of short line segments will be drawn on the canvas.
# This code gets ready for that:
offset = 5 # just a few pixels away from the edge
dx = 20 # stepsize in horizontal direction
stime = .15 # real time delay between segments (seconds)

# Y and Z are the model's dependent variables, unscaled.
# ypix and zpix are the scale values in pixels.
# xpix represents time, in pixels horizontally.
yscale = zscale = 10.0
def nexpix(x):
"returns a tuple of the pixel values representing the models output"
Y, Z = model.next()
ypix = int((high/2)-Y*yscale)
zpix = int((high/2)-Z*zscale)
return x+dx, ypix, zpix

# compute the starting points:
xs, ys, zs = nexpix(offset-dx)

def draw(stime):
"Repeatedly draws line segments, calling the model for values:"
global xs,ys,zs,dx
# get the user control values:
pc1, pc2, pc3 = scale.get(), scal.get(), sca.get()
while 1:
sleep(stime)
while(Halt):
sleep(.1)
# get the user control values:
c1, c2, c3 = scale.get(), scal.get(), sca.get()
if(c1 != pc1):
model.modA(c1, pc1)
pc1 = c1
if(c2 != pc2):
model.modB(c2, pc2)
pc2 = c2
if(c3 != pc3):
model.modC(c3, pc3)
pc3= c3
#update the model, then draw a line segment for each variable:
xf, yf, zf = nexpix(xs)
l1 = canvas.create_line(xs, ys, xf, yf, width=2,fill="blue")
l2 = canvas.create_line(xs, zs, xf, zf, width=2,fill="green")
# save the endpoints; they will become the starting points:
xs,ys,zs = xf, yf, zf
# This is to delete the older, offscreen, line segments:
if l1 > 100 and l2 > 100:
canvas.delete(l1-100);canvas.delete(l2-100)
if xs >= wide:
canvas.move(ALL,-dx,0)
xs = xs - dx

start_new_thread(draw,(stime,))

root.mainloop()

Jul 18 '05 #6
<sn***********@yahoo.com> wrote in message news:<ma**************************************@pyt hon.org>...
I've trolled the lists, FAQs, and Net as a whole, but
can't find anything definitive to answer this.

We're looking for real-time graph capability (bar,
line, etc), so that we can display telemetry from a
robot system. There are a bunch of packages out
there, but many seem to provide only static graphs
(e.g. for scientific, financial data, etc). Does
anyone currently display real-time telemetry using
Python? Can anyone provide any suggestions?

TIA
Stephen


Where I once worked, they used Blt for Tkinter under the Pmw toolkit for Python.

See:

http://pmw.sourceforge.net
http://heim.ifi.uio.no/~hpl/Pmw.Blt/doc

The latter site has some good illustrative examples.
Jul 18 '05 #7
> Where I once worked, they used Blt for Tkinter under the Pmw toolkit for Python.

See:

http://pmw.sourceforge.net
http://heim.ifi.uio.no/~hpl/Pmw.Blt/doc

The latter site has some good illustrative examples.

I've been trying to get this to work under unix, but I cannot get Pmw
to find BLT. Does anyone have any ideas?

jonathon
Jul 18 '05 #8
gsm
look at http://www.advsofteng.com/

ChartDirector is free and really good, best package that I know for
graphing, also provides you with a base livbrary for designing your own, its
engine is very small and design for the web etc, its output is exceptional
in terms of font quality etc

supports NET, ASP, COM, VB, JSP,Java, PHP, Perl, Python, C++

<sn***********@yahoo.com> wrote in message
news:ma**************************************@pyth on.org...
I've trolled the lists, FAQs, and Net as a whole, but
can't find anything definitive to answer this.

We're looking for real-time graph capability (bar,
line, etc), so that we can display telemetry from a
robot system. There are a bunch of packages out
there, but many seem to provide only static graphs
(e.g. for scientific, financial data, etc). Does
anyone currently display real-time telemetry using
Python? Can anyone provide any suggestions?

TIA
Stephen

Jul 18 '05 #9
It looks sharp, but the free version has watermarks and is
distributable only in free software.
Jul 18 '05 #10
Thanks for the info, all. It is certainly helping! Collating it all,
and given our current setup and requirements (not web based, no Java,
wxPython, lots of real time graphs per screen, Mac OS X and Linux), it
seems only a couple of possibilities stand out.

- VPython
- matplotlib

Having said that, neither of these appeared to come with examples with
wxPython, but I guess you can't ask for everything! :-)

Does anyone have any direct experience with either of these inside of
wxPython? It appears that matplotlib will directly work with wxPython,
not so for VPython?

If we were using Tkinter, we might have other options apparently. I
also have noticed a couple of other packages that no-one noted here

- DISLIN
- pgplot

Does anyone have any experience with these in a wxPython setting?

TIA
Jul 18 '05 #11
Tom
I do lab instrument programming - moving stages, polling sensors &
controlling instruments. My GUIs have lots of visual feedback - live
charts, buttons, indicators, meters, gauges. I use wxPython for the
GUI framework, python+numeric for lots of the number
crunching/analysis, and swig for wrapping hardware drivers/dlls. For
the gauge, plot, and button widgets, I use the national instruments
"measurement studio" activex objects through wxPython activex hosting.
This works well and was very easy - esp. if you use the CVS BOA
constructor IDE. Of course it requires that you buy the NI
measurement studio for Visual basic. I already had it because I used
to use labview/labwindows for this stuff. It will cost you like $800
for just the widgets (no labview) if I recall correctly.

There are many other commercial visual basic/activex widget sets for
lab instrumentation/process monitoring. Take your pick. Some will be
cheaper/faster/better I'm sure.

the disadvantage of this approach is that 1) costs money 2) the vendor
will probably only offer VB support, not Python 3) windows only. None
of these are a problem for me, since most hardware drivers are windows
only anyway.

Some day some one will make a great lightweight plotting widget that
will drop right into wxpython no problem. I might even do this. But
it hasn't happened yet. THere are a hundred plotting packages that
shoehorn into wxpython - scipy/chaco, NCARgraphics, and a lot more
I've tried and forgotten. They are all too slow, too immature, or too
much trouble to use. But wxPython works very well with Activex
widgets. They look really good, are fast, and the wrapped widget
classes are very pythonic to program.

<sn***********@yahoo.com> wrote in message news:<ma**************************************@pyt hon.org>...
I've trolled the lists, FAQs, and Net as a whole, but
can't find anything definitive to answer this.

We're looking for real-time graph capability (bar,
line, etc), so that we can display telemetry from a
robot system. There are a bunch of packages out
there, but many seem to provide only static graphs
(e.g. for scientific, financial data, etc). Does
anyone currently display real-time telemetry using
Python? Can anyone provide any suggestions?

TIA
Stephen

Jul 18 '05 #12
sn***********@yahoo.com wrote:
I've trolled the lists, FAQs, and Net as a whole, but
can't find anything definitive to answer this.

We're looking for real-time graph capability (bar,
line, etc), so that we can display telemetry from a
robot system. There are a bunch of packages out
there, but many seem to provide only static graphs
(e.g. for scientific, financial data, etc). Does
anyone currently display real-time telemetry using
Python? Can anyone provide any suggestions?


I suspect matplotlib will be your best choice, but you might also check out
HippoDraw (google for it). It's Qt-based, designed to read instrument data at
SLAC (Stanford Linear Accelerator). I've seen demos of it, and it looked very
good.

Best,

f
Jul 18 '05 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Aaron W. West | last post by:
Timings... sometimes there are almost too many ways to do the same thing. The only significant findings I see from all the below timings is: 1)...
2
by: cwdjr | last post by:
Real One has a page to copy on their site that detects if the browser of a viewer of a page has Real One installed. The page is located at...
4
by: Allan Adler | last post by:
I'm trying to reinstall RedHat 7.1 Linux on a PC that was disabled when I tried to upgrade from RH7.1 to RH9. This is presenting lots of unexpected...
10
by: Pavils Jurjans | last post by:
Hallo, It is know issue that due to the fact that computer has to store the real numbers in limited set of bytes, thus causing a minor...
17
by: David Scemama | last post by:
Hi, I'm writing a program using VB.NET that needs to communicate with a DOS Pascal program than cannot be modified. The communication channel is...
5
by: Henry Wu | last post by:
Hi, now that in .NET everything is on millimeter, I was wondering how can one convert Pixel to Millimeter and any user's screen/monitor. I saw the...
0
by: support | last post by:
Veteran Real Estate Investor Shares some of his best Insider Secrets for successful investments! www.RealEstateBeginners.ws Have you ever...
12
by: Raymond Hettinger | last post by:
I am evaluating a request for an alternate version of itertools.izip() that has a None fill-in feature like the built-in map function: >>>...
16
by: DirtyHarry | last post by:
Good day everyone. This sounds like a stupid question, but I became just curious yesterday, and I looked up several textbooks. However, no...
2
by: Tim | last post by:
Folks, Can anyone thow some clarifying light on the following? I have come across a column with the same name and same data contents defined...
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
1
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.