-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfilereader.py
123 lines (95 loc) · 3.32 KB
/
filereader.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
import re
import csv
p = re.compile("[-+]?\d*\.\d*e*[-+]*\d*|\d+")
def readFromFileChFig1():
data = []
with open("TremorData/ChFig1.txt", "r") as csvfile:
readCSV = csv.reader(csvfile, delimiter=',')
for row in readCSV:
data.append([float(i) for i in row])
data = list(zip(*data))
return data
def readFromFileChFig3():
# Bi-axial hand tremor, RH Sampling rate: 100/sec
# x: RH measuring P+/S deg/sec
# y: RH measuring F+/E deg/sec
# z: RL measuring ankle F+/E, deg/sec
# a: LL measuring ankle F/E+, deg/sec
data = []
with open("TremorData/ChFig3.txt", "r") as csvfile:
readCSV = csv.reader(csvfile, delimiter=',')
for row in readCSV:
data.append([float(i) for i in row])
data = list(zip(*data))
return data[1:]
def readFromFileChFig4():
# Bi-axial hand tremor, RH Sampling rate: 100/sec
# x: RH measuring P+/S deg/sec
# y: RH measuring F+/E deg/sec
data = []
with open("TremorData/ChFig4.txt", "r") as csvfile:
readCSV = csv.reader(csvfile, delimiter=',')
for row in readCSV:
data.append([float(i) for i in row])
data = list(zip(*data))
return data
def readFromFileChFig5():
# Concurrent rest tremors, RH, LH. Sampling rate: 100/sec
# x: LH measuring P/S+ deg/sec
# y: RH measuring P+/S deg/sec
data = []
with open("TremorData/ChFig5.txt", "r") as csvfile:
readCSV = csv.reader(csvfile, delimiter=',')
for row in readCSV:
data.append([float(i) for i in row])
data = list(zip(*data))
return data
def readFromFileChFig6():
# Bi-axial, bilateral records, RH, LH. LH rest tremor, RH voluntary P/S
# x: RH measuring P+/S deg/sec
# y: LH measuring P+/S deg/sec
# z: RH measuring F+/E deg/sec
# a: LH measuring F/E+ deg/sec
data = []
with open("TremorData/ChFig6.txt", "r") as csvfile:
readCSV = csv.reader(csvfile, delimiter=',')
for row in readCSV:
data.append([float(i) for i in row])
data = list(zip(*data))
return data[1:]
def readFromFileChFig7():
# Bilateral postural tremor
# x: RH measuring F+/E deg/sec
# y: LH measuring F/E+ deg/sec
data = []
with open("TremorData/ChFig7.txt", "r") as csvfile:
readCSV = csv.reader(csvfile, delimiter=',')
for row in readCSV:
data.append([float(i) for i in row])
data = list(zip(*data))
return data[1:]
def readFromFileChFig8():
# Action tremor LH Accompanies voluntary LH P/S
# x: RH measuring P+/S deg/sec
# y: LH measuring P+/S deg/sec
data = []
with open("TremorData/ChFig8.txt", "r") as csvfile:
readCSV = csv.reader(csvfile, delimiter=',')
for row in readCSV:
data.append([float(i) for i in row])
data = list(zip(*data))
return data[1:]
def readFromAllFiles():
allFiles = []
allMeasurments = []
allFiles.append(readFromFileChFig1())
allFiles.append(readFromFileChFig3())
allFiles.append(readFromFileChFig4())
allFiles.append(readFromFileChFig5())
allFiles.append(readFromFileChFig6())
allFiles.append(readFromFileChFig7())
allFiles.append(readFromFileChFig8())
for f in allFiles:
for m in f:
allMeasurments.append(m)
return allMeasurments