-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest.py
122 lines (74 loc) · 4.87 KB
/
test.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
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 09 21:54:14 2015
@author: Shamir
"""
try:
for k in range(num_columns):
#print 'file = ', i, "row = ", j, "col = ", k
output_list.append(firstFile.loc [j, k])
output_list.append(secondFile.loc[j, k])
output_list.append(thirdFile.loc [j, k])
output_list.append(fourthFile.loc[j, k])
except KeyError:
#error = e.message[-26:-23]
try:
num_columns = len(secondFile.values[0])
for k in range(num_columns):
#print 'file = ', i, "row = ", j, "col = ", k
output_list.append(firstFile.loc [j, k])
output_list.append(secondFile.loc[j, k])
output_list.append(thirdFile.loc [j, k])
output_list.append(fourthFile.loc[j, k])
except KeyError:
try:
num_columns = len(thirdFile.values[0])
for k in range(num_columns):
#print 'file = ', i, "row = ", j, "col = ", k
output_list.append(firstFile.loc [j, k])
output_list.append(secondFile.loc[j, k])
output_list.append(thirdFile.loc [j, k])
output_list.append(fourthFile.loc[j, k])
except KeyError:
num_columns = len(fourthFile.values[0])
for k in range(num_columns):
#print 'file = ', i, "row = ", j, "col = ", k
output_list.append(firstFile.loc [j, k])
output_list.append(secondFile.loc[j, k])
output_list.append(thirdFile.loc [j, k])
output_list.append(fourthFile.loc[j, k])
except KeyError as e:
if num_columns > 1000:
error = int(e.message[-26:-22])
print 'columns > 1000 ', 'error value = ', error
num_columns = error
for k in range(num_columns):
#print 'file = ', i, "row = ", j, "col = ", k
output_list.append(firstFile.loc [j, k])
output_list.append(secondFile.loc[j, k])
output_list.append(thirdFile.loc [j, k])
output_list.append(fourthFile.loc[j, k])
else:
error = int(e.message[-26:-23])
print 'columns < 1000 ', 'error value = ', error
num_columns = error
for k in range(num_columns):
#print 'file = ', i, "row = ", j, "col = ", k
output_list.append(firstFile.loc [j, k])
output_list.append(secondFile.loc[j, k])
output_list.append(thirdFile.loc [j, k])
output_list.append(fourthFile.loc[j, k])
# Left Hand Gestures
print 'Calculating LH Features'
print 'Calculating variance'
variance_l = Variance(source_left)
print 'Calculating range'
range_l = Range(source_left)
print 'Calculating velocity'
velocity_l = Velocity(source_left)
print 'Calculating angular velocity'
AngVel_l = AngularVelocity(source_left_Euclid)
print 'Calculating covariance'
covar_l = Covariance(source_left)
fullFile_l = pandas.concat([variance_l, range_l, velocity_l, AngVel_l, covar_l], axis = 1)
fullFile_l.to_csv(destination + left + fileformat, header = False, index = False)