-
Notifications
You must be signed in to change notification settings - Fork 6
/
fix_log.py
46 lines (39 loc) · 1.2 KB
/
fix_log.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
from input_output import IOUtility, Input, Output
from server import Server
# logs = ['result/11.19/log-differentsensor']
# output_dir = 'result/11.19'
# output_file = 'log-differentsensor2'
# server = Server(output_dir, output_file)
# f = open(logs[0], 'r')
# while True:
# line = f.readline()
# if line == '': # EOF
# break
# myinput = Input.from_json_str(line)
# outputs = []
# i = 1
# line = f.readline()
# while line != '' and line != '\n':
# output = Output.from_json_str(line)
# if i == 2:
# output.method = 'dl2'
# i += 1
# outputs.append(output)
# line = f.readline()
# server.log(myinput, outputs)
logs = ['result/3.1/ipsn-all-5010']
f = open(logs[0], 'r')
while True:
line = f.readline()
if line == '': # EOF
break
myinput = Input.from_json_str(line)
num_is_2 = False
if myinput.num_intruder == 2:
num_is_2 = True
line = f.readline()
while line != '' and line != '\n':
output = Output.from_json_str(line)
if num_is_2 and output.miss != 0:
print(f'Experiment # = {myinput.experiment_num}, method = {output.method}')
line = f.readline()