Now and then the need arises to plot data in realtime. I know how simple this is using LabView but I always pefer Python for its versatility in data analysis.
However when it comes to plotting data in realtime I have never seen any easy solution for Python.
For my daily plotting needs I mostly use matplotlib but the Bokeh project is currently ahead when it comes to interactive plotting for the web.
Another exciting development has been Python3's asyncio which is python's native approach to an event driven framework. This puts python in the spotlight for io-bound applications for which people would use node.js.
Combing the Bokeh and asyncio allows building an interactive, realtime plotting application in less then 30 lines of code. I did not find any official documentation on how to do this so I decided to provide my own adapted from the official example here. I suggest to have a look at the official example to get a better understanding how the asyncio version works. In essen…
n = len(identifiers) values = [.0]*n valuecount = 0
for line in process.stdout: line = line.split() values[valuecount] = line valuecount += 1
output = "" for i,j in zip(identifiers,values): j = str(j) output += (i+j+" ") print output
It is called by cacti using
python /scripts/check_digitemp.py cool air hot out
The parameters given to the script are simply labels of your choice. Just make shure they fit the number of sensors installed. Also make sure /etc/digitemp.conf exists and the cacti user (in my case www-data…
Use frozen carbon dioxide (dry ice), mix it with water and pipe the steam into a PET bottle. When the bottle at roughly 22bar explodes you can shoot for example a toy chicken over more than 80 meters (We had serious problems to build a projectile that is not destroyed by the power of the launch). We built the device for a creativity competition at our university. And well, we could not place an object accurate on 20m but for shure we did it with the biggest impact.
If you are curious, here some detail about the construction:
For us secure handling was not only an option. We have seen some people that put water and dry-ice together into an bottle close it and put it into a pipe. But you have good chances that it will explode in your hands. So we put an PET bottle into our pipe and connect it with an CNC made adapter to the presure reservoir outside. Beside that, all parts are made from steel and welded. We experienced that a 1.5l coke bottle (actually we used Dei…