-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot.py
executable file
·30 lines (25 loc) · 871 Bytes
/
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
import matplotlib.pyplot as plt
import csv
import numpy as np
from os import listdir
from os.path import isfile, join
def bestandinlezen(file):
x = []
y = []
with open(file, newline='') as csvfile:
bestand1 = csv.reader(csvfile, delimiter=',', quotechar='|')
for row in bestand1:
x.append(float(row[0]))
y.append(int(row[1]))
return x, y
path2files = "demo/data/" # Path to csv-files directory
path2idle = "demo/idle-value/ruis2.csv" # Path to idle file (noise)
files = [f for f in listdir(path2files) if isfile(join(path2files, f))]
for i in range(len(files)):
print("{:<4}{:>}".format(i, files[i]))
index = int(input("Give index number: "))
x1, y1 = bestandinlezen(path2files+files[index])
x2, y2 = bestandinlezen(path2idle) # Idle value to set 0 point
y = y1 - np.average(y2)
plt.plot(x1, y)
plt.show()