-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdataReader.py
More file actions
51 lines (37 loc) · 942 Bytes
/
Copy pathdataReader.py
File metadata and controls
51 lines (37 loc) · 942 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import csv
import numpy as np
import numpy.matlib
def primaryRead(filename):
'''
Returns a list of data lists.
'''
d = []
with open(filename) as f:
reader = csv.reader(f, delimiter="\t")
d = list(reader)
n = len(d[0]) // 17
rows = len(d)
output = []
for i in range(n):
temp = []
for j in range(rows):
temp.append(d[j][i * 17 : 17 + i * 17])
output.append(temp)
return output
def XYZ(rawDataCol):
'''
Returns a list of N numpy matricies, each (1 x 3).
'''
out = []
for row in rawDataCol:
out.append( np.matlib.matrix( [float(row[i]) for i in range(4,7)] ) )
return out
def rotation(rawDataCol):
'''
Returns a list of N numpy matricies, each (3 x 3).
'''
out = []
for row in rawDataCol:
r = [ [float(row[7]),float(row[8]),float(row[9])] , [float(row[10]),float(row[11]),float(row[12])] , [float(row[13]),float(row[14]),float(row[15])] ]
out.append( np.matlib.matrix(r) )
return out