3 matplotlib.use('QT4Agg')
5 import matplotlib.pyplot as plt
7 FLOAT = "([-+]?[0-9]*\.?[0-9]+)"
8 INT = "([-+]?[0-9][0-9]*)"
29 regex = "%s.*gyro\s*%s\s*%s\s*%s\s*"%(INT, FLOAT, FLOAT, FLOAT)
30 regex += "accel\s*%s\s*%s\s*%s\s*"%(FLOAT, FLOAT, FLOAT)
31 regex += "magnet\s*%s\s*%s\s*%s\s*"%(FLOAT, FLOAT, FLOAT)
33 m = re.match(regex, l)
35 t, g1, g2, g3, a1, a2, a3, m1, m2, m3 = map(lambda x: float(x), m.groups())
46 print t, g1, g2, g3, a1, a2, a3, m1, m2, m3
50 for i in range(len(tab)-n):
51 s = reduce(lambda x,y:x+y, tab[i:i+n], 0)
55 tab_a1 = mean(tab_a1, FILTER)
56 tab_a2 = mean(tab_a2, FILTER)
57 tab_a3 = mean(tab_a3, FILTER)
58 tab_g1 = mean(tab_g1, FILTER)
59 tab_g2 = mean(tab_g2, FILTER)
60 tab_g3 = mean(tab_g3, FILTER)
61 tab_m1 = mean(tab_m1, FILTER)
62 tab_m2 = mean(tab_m2, FILTER)
63 tab_m3 = mean(tab_m3, FILTER)
65 # line, = plt.plot(tab_t[:-FILTER], tab_a1, 'r-')
66 # line, = plt.plot(tab_t[:-FILTER], tab_a2, 'g-')
67 # line, = plt.plot(tab_t[:-FILTER], tab_a3, 'b-')
69 line, = plt.plot(tab_t[:-FILTER], tab_g1, 'r-')
70 line, = plt.plot(tab_t[:-FILTER], tab_g2, 'g-')
71 line, = plt.plot(tab_t[:-FILTER], tab_g3, 'b-')
73 # line, = plt.plot(tab_t[:-FILTER], tab_m1, 'r-')
74 # line, = plt.plot(tab_t[:-FILTER], tab_m2, 'g-')
75 # line, = plt.plot(tab_t[:-FILTER], tab_m3, 'b-')
78 #dashes = [10, 5, 100, 5] # 10 points on, 5 off, 100 on, 5 off
79 #line.set_dashes(dashes)