473,404 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 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 9421
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) Integer math is generally fastest, naturally....
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 difficulties. Apart from wanting to keep the old...
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 imprecision from the decimal value that likely was stored....
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 through some file databases, and I have a huge...
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 following code on how to convert pixel to...
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 wondered about investing in real estate? Maybe one...
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: >>> map(None, 'abc', '12345') # demonstrate map's None...
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 textbooks on computer language (that I have ) mentioned...
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 on different tables, on some the column is defined...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.