diff options
| author | Tim Redfern <tim@eclectronics.org> | 2013-12-06 12:39:56 +0000 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2013-12-06 12:39:56 +0000 |
| commit | 4b313553d04d014291a7503c965624bf3e5279c4 (patch) | |
| tree | b43fd604c4a215695f3c099af2b7c1e4bd0fed4b /rotord/httplot | |
| parent | 7ed9d7c6bdf4cce9c4dcd300a5f212f08c3661df (diff) | |
signal graphing
Diffstat (limited to 'rotord/httplot')
| -rwxr-xr-x | rotord/httplot | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/rotord/httplot b/rotord/httplot index 6b235f9..8f48dce 100755 --- a/rotord/httplot +++ b/rotord/httplot @@ -12,10 +12,31 @@ connection.request(args.method, args.path, args.body) response= connection.getresponse().read() import xml.etree.ElementTree as ET +import sys root = ET.fromstring(response) -signal= root.find("signal").text -output =signal.replace(",", "\n") -print output +try: + signal= root.find("signal").text +except AttributeError: + print "Error: no data found. check node ID" + sys.exit(0) + +o1 =signal.split(",") +x=[] +y=[] +for item in o1: + op=[] + o2 = item.split() + for s in o2: + op.append(float(s)) + if len(o2) > 1: + x.append(float(o2[0])) + y.append(float(o2[1])) + +import matplotlib.pyplot as plt +plt.plot(x,y) +plt.ylabel('signal') +plt.xlabel('time') +plt.show() #print response #connection = httplib.HTTPConnection('54.228.219.55:80') |
