Skip to content

Commit 34320c4

Browse files
committed
First cut at demo plots
- Clean up extraneous print statements in the test program - First attempt at Bokeh plot.py - Sample chart for outA - motor reset command seems to take a while to have any effect
1 parent df70605 commit 34320c4

File tree

3 files changed

+340
-3
lines changed

3 files changed

+340
-3
lines changed

tests/motor/outA.html

Lines changed: 307 additions & 0 deletions
Large diffs are not rendered by default.

tests/motor/plot.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import json
2+
import bokeh.plotting
3+
import bokeh.embed
4+
import bokeh.resources
5+
import bokeh.models
6+
7+
#bokeh.plotting.output_notebook()
8+
test = json.loads( open( 'motorlog.json' ).read() )
9+
10+
r = bokeh.resources.Resources()
11+
12+
for k,d in test['data'].items():
13+
print k
14+
x = [row[0] for row in d]
15+
y0 = [row[1][0] for row in d]
16+
y1 = [row[1][1] for row in d]
17+
y2 = [row[1][2] for row in d]
18+
19+
p = bokeh.plotting.figure(height=300, width=800, title=k)
20+
21+
p.y_range=bokeh.models.Range1d(-200,2000)
22+
p.extra_y_ranges = { 'foo': bokeh.models.Range1d(start=-200, end=2000),
23+
'duty_cycle': bokeh.models.Range1d(start=-10, end=100) }
24+
#p.add_layout( bokeh.models.LinearAxis(y_range_name='position'), 'right')
25+
p.add_layout( bokeh.models.LinearAxis(y_range_name='duty_cycle'), 'right')
26+
27+
p.line(x, y0, legend='speed', line_width=2, color='red', y_range_name='foo')
28+
p.line(x, y1, legend='position', line_width=2, color='blue', y_range_name='foo')
29+
p.line(x, y2, legend='duty_cycle', line_width=2, color= 'green', y_range_name='duty_cycle')
30+
31+
o = open('{0}.html'.format(k), 'w')
32+
o.write( bokeh.embed.file_html(p, r, title='foo' ) )
33+

tests/motor/test.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,11 @@ def join(self, timeout=None):
5959
for a in test['actions']:
6060
then = start + a['time'] * 1e-3
6161
while time.time() < then: pass
62-
print a['time']
6362

6463
for p,c in a['ports'].items():
65-
print " ", p
6664
for b in c:
6765
for k,v in b.items():
6866
setattr( device[p], k, v )
69-
print " ", k, v
7067

7168
while time.time() < end:
7269
pass

0 commit comments

Comments
 (0)