forked from yunzhewong/ALEX-Capstone-2024
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathseparator.py
More file actions
31 lines (22 loc) · 728 Bytes
/
separator.py
File metadata and controls
31 lines (22 loc) · 728 Bytes
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
import csv
def writeCVP(file, data, index):
time = data[0]
c = data[index * 3 + 1]
v = data[index * 3 + 2]
p = data[index * 3 + 3]
file.write(f"{time}, {c}, {v}, {p}\n")
with open("flipped.csv", mode="r") as file:
csv_reader = csv.reader(file)
header = next(csv_reader) # Read the first line as header (if present)
abductor = open("abductor.csv", mode="w")
extensor = open("extensor.csv", mode="w")
knee = open("knee.csv", mode="w")
# Iterate through the rows
for data in csv_reader:
time = data[0]
writeCVP(abductor, data, 1)
writeCVP(extensor, data, 3)
writeCVP(knee, data, 5)
abductor.close()
extensor.close()
knee.close()