diff options
| -rwxr-xr-x | rotord/httplot | 27 | ||||
| -rw-r--r-- | rotord/src/graph.cpp | 2 |
2 files changed, 25 insertions, 4 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') diff --git a/rotord/src/graph.cpp b/rotord/src/graph.cpp index fdbd4c8..737aeab 100644 --- a/rotord/src/graph.cpp +++ b/rotord/src/graph.cpp @@ -34,7 +34,7 @@ bool Graph::signal_render(xmlIO &XML,const string &node,const float framerate) { float sig=0.0f; string val=""; for (float i=0;i<duration;i+=1.0f/framerate){ - float s=(signal_output->get_output(Time_spec(i,framerate,duration))+1.0f)/10.0f; + float s=(signal_output->get_output(Time_spec(i,framerate,duration))); if (!fequal(sig,s)){ val+=toString(i)+" "+toString(s)+","; sig=s; |
