-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtemp.py
More file actions
67 lines (62 loc) · 1.88 KB
/
temp.py
File metadata and controls
67 lines (62 loc) · 1.88 KB
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
def TimestampedData():
D = {}
D['type'] = 'TimestampedData'
D['Purpose'] = d2s(inspect.stack()[0][3],':','Dictionary structure for holding lists of data corresponding to list of timestamps.')
D['ts'] = []
def _validate_timestamps():
len_ts = len(D['ts'])
for k in D.keys():
if type(D[k]) == list:
assert(len(D[k]) == len_ts)
def _load(d):
path = d['path']
assert(len(gg(path))>0)
e = zload_obj({'path':path})
#print(d2s('e =',e))
for k in D.keys():
if type(D[k]) == list:
del D[k]
for k in e.keys():
D[k] = e[k]
_validate_timestamps()
D['load'] = _load
def _save(d):
path = d['path']
zsave_obj({'obj':D,'path':d['path']})
D['save'] = _save
return D
def Left_Image_Bound_To_Data_TS():
D = TimestampedData()
D['Purpose'] = d2s(inspect.stack()[0][3],':','Hold left_image_boud_to_data in TimestampedData format.\n') + D['Purpose']
D['type'] = 'Left_Image_Bound_To_Data_TS'
D['acc'] = []
D['encoder'] = []
D['gyro'] = []
D['gyro_heading'] = []
D['motor'] = []
D['right_image'] = []
D['state'] = []
D['steer'] = []
def _translate_from_left_image_bound_to_data(d):
path = d['path']
L=lo(path)
D['ts'] = sorted(L.keys())
for t in a['ts']:
for k in L[t].keys():
D[k].append(L[t][k])
D['translate_from_left_image_bound_to_data'] = _translate_from_left_image_bound_to_data
return D
src = '/Volumes/SSD_2TB/bair_car_data_new_28April2017/meta'
dst = opjD('meta')
runs = sggo(src,'*')
for r in runs:
if len(sggo(r,'left_image_bound_to_data.pkl')) > 0:
a = Left_Image_Bound_To_Data_TS()
a['translate_from_left_image_bound_to_data'](
{'path':opj(r,'left_image_bound_to_data.pkl')})
a['save']({'path':opjD('meta',fname(r),'left_image_bound_to_data_TS')})
"""
v = Left_Image_Bound_To_Data_TS()
v['load']({'path':opjD('meta','caffe2_z2_color_direct_local_11Apr17_15h25m02s_Mr_Silver','left_image_bound_to_data_TS')})
v['save']({'path':opjD('v')})
"""