-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathedit_collected_data.py
More file actions
48 lines (30 loc) · 938 Bytes
/
edit_collected_data.py
File metadata and controls
48 lines (30 loc) · 938 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
import json
import arrow
import glob
def add_chip_time(data, name):
capture_time = arrow.get(data['capture_time'])
change_time = arrow.get('2018-06-05')
if 'chip_time' in data:
print(f'Skipping {name}')
return
if capture_time > change_time:
data['chip_time'] = '13.424 ms'
else:
data['chip_time'] = '11.54 ms'
def add_symbol_number(data, name):
if 'symbol_number' in data:
print(f'Skipping {name}')
return
print(data['location'])
print(data['description'])
symbol_number = int(input('Symbol number: '))
print('\n')
data['symbol_number'] = symbol_number
data_files = glob.glob('collected_data/*.json')
for data_file in data_files:
with open(data_file) as f:
data = json.load(f)
# add_chip_time(data, data_file)
add_symbol_number(data, data_file)
with open(data_file, 'w') as f:
json.dump(data, f)