-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmod.py
67 lines (49 loc) · 1.27 KB
/
mod.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import openpyxl as opx
import numpy as np
import pandas as pd
import matplotlib.pyplot as mpl
import sys
#"Constants", the cursor cells
FP_0 = 'B5'
FP_1 = 'B6'
SA_0 = 'B9'
SA_1 = 'B10'
SA_2 = 'B11'
SA_3 = 'B12'
SA_4 = 'B13'
SA_5 = 'B14'
def Update(fn):
wb = opx.load_workbook(fn)
ws = wb.active
ws[FP_0] = 'New Value'
ws[FP_1] = 'New Value'
ws[SA_0] = 'New Value'
ws[SA_1] = 'New Value'
ws[SA_2] = 'New Value'
ws[SA_3] = 'New Value'
ws[SA_4] = 'New Value'
ws[SA_5] = 'New Value'
wb.save(fn)
def Find_Fingers(data):
fingers = {}
#TODO
return fingers
def To_DataFrame(fn):
df = pd.read_csv(fn, delimiter='\t')
df.columns = ['y1', 'y2', 'y3', 'y4', 'y5', 'y6', 'y7', 'Volts'] #need to fingure this out still
return df
def Plot_All(fingers, data_df):
for col in data_df.drop('Volts', axis=1).columns:
mpl.plot(data_df['Volts'], data_df[col], label=col)
mpl.legend()
mpl.show()
def main():
if(len(sys.argv) != 3):
print("ERROR: args must be of format \" [data_file.csv] [tuning_file.xlsx]\"")
sys.exit()
data_df = To_DataFrame(sys.argv[1])
tuning_fn = sys.argv[2]
fingers = Find_Fingers(data_df)
Plot_All(fingers, data_df)
if __name__ == "__main__":
main()