-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathload_and_plot.py
47 lines (35 loc) · 1.06 KB
/
load_and_plot.py
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
43
44
45
46
47
import SixChannelReader as SCR
import matplotlib.pyplot as plt
import numpy as np
def main():
""" open previously saved data and plot it. Convert raw 12-bit ADC data to voltage """
filename = "TestData-2015-05-15-1306.pkl"
SR = SCR.SerialDataLogger()
t, C1, C2, C3, C4, C5, C6 = SR.load_data(filename)
fig = plt.figure("Test load plot",figsize=(5,12))
plt.clf()
ax1 = fig.add_subplot(611)
ax2 = fig.add_subplot(612,sharex=ax1)
ax3 = fig.add_subplot(613,sharex=ax1)
ax4 = fig.add_subplot(614,sharex=ax1)
ax5 = fig.add_subplot(615,sharex=ax1)
ax6 = fig.add_subplot(616,sharex=ax1)
ax1.plot(t,C1*3.3/4095)
ax2.plot(t,C2*3.3/4095)
ax3.plot(t,C3*3.3/4095)
ax4.plot(t,C4*3.3/4095)
ax5.plot(t,C5*3.3/4095)
ax6.plot(t,C6*3.3/4095)
ax1.set_xlim(t[0],t[-1])
for ax in [ax1,ax2,ax3,ax4,ax5,ax6]:
ax.set_ylim(0,3.3)
ax6.set_xlabel('Time (ms)')
ax1.set_ylabel('A0 (V)')
ax2.set_ylabel('A1 (V)')
ax3.set_ylabel('A2 (V)')
ax4.set_ylabel('A3 (V)')
ax5.set_ylabel('A4 (V)')
ax6.set_ylabel('A5 (V)')
fig.tight_layout()
if __name__ == '__main__':
main()