-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot.py~
More file actions
executable file
·42 lines (38 loc) · 1.65 KB
/
Copy pathplot.py~
File metadata and controls
executable file
·42 lines (38 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"""
Demo of a simple plot with a custom dashed line.
A Line object's ``set_dashes`` method allows you to specify dashes with
a series of on/off lengths (in points).
"""
import numpy as np
import matplotlib.pyplot as plt
import os
from main import *
x = np.linspace(0, 10)
#fig, axes = plt.subplots(nrows = 3, ncols = 1, sharex = True, sharey = True)
dataCollection = parse(argv[1])
numSensors = (len(dataCollection)-1)/3
print "Number of sensors: "+str(numSensors)
plt.figure(0)
#Calculate rate of data acquisition. Returns a vector with data per second.
frequency = freq(dataCollection[0])
stDev = np.std(frequency)
print "Filesize is: "+str(path.getsize(argv[1]))
print "Runtime is: "+str(dataCollection[0][-1])+" seconds"
print "Mean value is: "+str(np.mean(frequency))
print "Standard Deviation is: "+str(stDev)
plt.ylim(0,1000)
plt.plot(range(len(frequency)),frequency, '-', linewidth=0.5)
for i in range(numSensors):
plt.figure(1)
#4 graphs per sensor. First one shows acceleration in all three axes. Second to fourth represent acceleration in x, y and z axis, respectively.
plt.subplot(numSensors, 4, 4*i+1)
plt.plot(dataCollection[0],dataCollection[i+1], 'r-', linewidth=0.1)
plt.plot(dataCollection[0],dataCollection[i+2], 'g-', linewidth=0.1)
plt.plot(dataCollection[0],dataCollection[i+3], 'b-', linewidth=0.1)
plt.subplot(numSensors, 4, 4*i+2)
plt.plot(dataCollection[0],dataCollection[i+1], 'r-', linewidth=0.1)
plt.subplot(numSensors, 4, 4*i+3)
plt.plot(dataCollection[0],dataCollection[i+2], 'g-', linewidth=0.1)
plt.subplot(numSensors, 4, 4*i+4)
plt.plot(dataCollection[0],dataCollection[i+3], 'b-', linewidth=0.1)
plt.show()