--- /dev/null
+import os
+
+class stripchart :
+ def __init__(self, pipename='strip_pipe', maxY=10, minY=-10,
+ npoints=100, title='chart', axes=True) :
+ self.pipename = pipename
+ self.maxY = maxY
+ self.minY = minY
+ self.npoints = npoints
+ self.title = title
+ self.axes = axes
+ self.status = 'closed'
+ self.pipe = None
+ def __del__(self) :
+ self.close()
+ def open(self, debug=False) :
+ if self.status == 'closed' :
+ os.mkfifo(self.pipename)
+ cmd = "stripchart -t '%s' -p '%s' -u -M '%g' -m '%g' -n '%d'" % \
+ (self.title, self.pipename, self.maxY, self.minY,
+ self.npoints)
+ if self.axes == False :
+ cmd += " -a"
+ cmd += " &"
+ if debug :
+ print cmd
+ os.system(cmd)
+ self.pipe = open(self.pipename,'w')
+ self.status = 'open'
+ def close(self) :
+ if self.status == 'open' :
+ print >> self.pipe, "q"
+ self.pipe.close()
+ self.pipe = None
+ self.status = 'closed'
+ def _add_point(self, point) :
+ print >> self.pipe, point
+ def _flush(self) :
+ self.pipe.flush()
+ def add_point(self, point) :
+ self._add_point(point)
+ self._flush()