-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlabelling.py
57 lines (40 loc) · 1.27 KB
/
labelling.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
import numpy as np
def toString(*args):
i = 0
for arg in args:
if type(arg)==list:
for a in arg:
if i == 0:
string = str(a)
else:
string += ";"+str(a)
elif i == 0:
string = str(arg)
else:
string += ";"+str(arg)
i += 1
return string
def translatePosition(plasseringer):
result = [-1,-1,-1,-1,-1,-1]
if plasseringer[0] == 0:
return result
positions = [(60,8);(110,30);(110,85); (60, 110); (20,85); (20,30)]
for i in range(len(plasseringer)):
result[i] = positions.pop(int(plasseringer[i]))
result[4] = positions[0]
result[5] = positions[1]
return result
f = open("labels.csv", 'w')
f.write("Name;left;mid;right")
brikkeInt = 2
variableNames = ["Cleft", "Cmid", "Cright", "Sleft", "Eleft", "Smid", "Emid"] #"Sright", "Eright"
variables = np.zeros(len(variableNames), dtype=str)
for i in range(brikkeInt):
name = "p"+str(i)
for j in range(len(variableNames)):
variables[j] = str(input(variableNames[j]+": "))
positions = translatePosition(variables[-4:])
string = toString(name, variables[:3], positions)
print(string)
f.write(string)
f.close()