From 4b313553d04d014291a7503c965624bf3e5279c4 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Fri, 6 Dec 2013 12:39:56 +0000 Subject: signal graphing --- rotord/httplot | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'rotord/httplot') 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') -- cgit v1.2.3