In [107]:
%matplotlib inline
import serial
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
filepath = "raw.tsv"

In [108]:
listfil = os.listdir("/dev/")
filt = lambda k: 'ttyACM' in k
acm_list = filter(filt, listfil)
ard_path = "/dev/%s" % (list(acm_list)[0])

In [109]:
ser = serial.Serial(ard_path, 9600)
with open(filepath, "wb") as fil:
    while True:
        fil.write(ser.readline())



KeyboardInterruptTraceback (most recent call last)
<ipython-input-109-03627012af02> in <module>()
      2 with open(filepath, "wb") as fil:
      3     while True:
----> 4         fil.write(ser.readline())

/usr/local/lib/python3.5/dist-packages/serial/serialposix.py in read(self, size)
    479             try:
    480                 start_time = time.time()
--> 481                 ready, _, _ = select.select([self.fd], [], [], timeout)
    482                 # If select was used with a timeout, and the timeout occurs, it
    483                 # returns with empty lists -> thus abort read operation.

KeyboardInterrupt: 

In [101]:
raw = pd.read_csv(filepath, delimiter="\t", names=('t', 'p', 'u', 'tbmp', 'tdht', 'none'))[1:]
x = raw.t / 1e6

In [102]:
plt.plot(x, raw.u,'-')
plt.show()



In [103]:
plt.plot(x, raw.tbmp,'-')
plt.plot(x, raw.tdht, '-')
plt.show()



In [49]:
raw


Out[49]:
t p u tbmp tdht none
1 431632508 934.96 58.4 22.10 22.5 NaN
2 433939172 934.97 58.5 22.10 22.6 NaN
3 436246772 934.89 58.4 22.09 22.6 NaN
4 438553464 934.99 58.3 22.11 22.6 NaN
5 440860196 934.95 58.3 22.11 22.6 NaN
6 443166900 934.91 58.3 22.11 22.6 NaN
7 445473608 934.96 58.3 22.12 22.6 NaN
8 447780240 934.92 58.1 22.12 22.6 NaN
9 450086856 934.88 58.1 22.12 22.6 NaN
10 452393464 934.85 58.2 22.11 22.6 NaN
11 454700100 934.87 58.2 22.14 22.6 NaN
12 457006716 934.93 58.2 22.16 22.6 NaN
13 459313428 934.88 58.3 22.16 22.6 NaN
14 461620132 934.87 58.3 22.15 22.6 NaN
15 463926840 934.87 58.3 22.16 22.6 NaN
16 466234584 934.85 58.3 22.16 22.6 NaN
17 468541204 934.89 58.1 22.17 22.6 NaN
18 470847820 934.97 58.1 22.17 22.6 NaN
19 473154444 934.91 58.1 22.16 22.6 NaN
20 475461072 934.94 58.1 22.16 22.6 NaN
21 477767604 934.91 58.0 22.17 22.6 NaN
22 480074132 934.87 58.0 22.15 22.6 NaN
23 482380784 934.88 57.9 22.17 22.6 NaN
24 484687456 934.96 57.9 22.17 22.6 NaN
25 486995056 934.92 57.8 22.17 22.6 NaN
26 489301620 934.92 57.8 22.16 22.6 NaN
27 491609212 934.89 57.8 22.16 22.6 NaN
28 493915780 934.91 57.8 22.17 22.6 NaN
29 496223372 934.91 57.8 22.17 22.6 NaN
30 498529944 934.88 57.8 22.17 22.6 NaN
... ... ... ... ... ... ...
42 526212236 934.85 58.1 22.23 22.6 NaN
43 528518748 934.93 58.0 22.24 22.6 NaN
44 530826372 934.82 58.0 22.23 22.7 NaN
45 533132924 934.98 57.7 22.26 22.6 NaN
46 535440616 934.88 57.8 22.24 22.7 NaN
47 537747096 934.94 57.6 22.25 22.6 NaN
48 540054744 934.93 57.9 22.26 22.7 NaN
49 542361340 934.90 58.0 22.26 22.7 NaN
50 544667940 934.89 58.0 22.25 22.7 NaN
51 546974548 934.92 57.9 22.25 22.7 NaN
52 549281212 934.92 57.8 22.25 22.7 NaN
53 551587888 934.87 57.8 22.25 22.7 NaN
54 553894496 934.95 57.9 22.27 22.7 NaN
55 556202136 934.91 57.9 22.27 22.7 NaN
56 558508744 934.89 57.9 22.25 22.7 NaN
57 560815408 934.98 57.8 22.28 22.7 NaN
58 563122072 934.90 57.8 22.27 22.7 NaN
59 565428748 934.88 57.8 22.27 22.7 NaN
60 567735416 934.96 57.8 22.28 22.7 NaN
61 570042076 934.90 57.8 22.28 22.7 NaN
62 572348740 934.89 57.8 22.28 22.7 NaN
63 574655356 935.01 57.9 22.30 22.7 NaN
64 576961980 934.88 57.9 22.30 22.7 NaN
65 579268580 934.95 57.9 22.30 22.7 NaN
66 581575240 934.88 57.8 22.30 22.7 NaN
67 583882924 934.91 57.8 22.30 22.7 NaN
68 586189572 934.93 57.8 22.33 22.7 NaN
69 588496188 934.80 57.9 22.31 22.7 NaN
70 590802796 934.88 57.9 22.31 22.7 NaN
71 593109416 934.90 57.9 22.32 22.7 NaN

71 rows × 6 columns


In [ ]: