-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtruncate_param_space.py
100 lines (66 loc) · 2.63 KB
/
truncate_param_space.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
import sys
tau_threshold = 0.025
#######################################
## read
with open("parameters.mig0_t5_p0.flexighosts.txt", "r") as INF:
params = [x for x in INF]
with open("ABCstat.mig0_t5_p0.flexighosts.txt", "r") as INF:
stats = [x for x in INF]
# WE NEED TO REMOVE ANY TIMEs < 0.0025
outlines_params = []
outlines_stats = []
for param_line, stats_line in zip( params, stats ):
try:
if float( param_line.split("\t")[ 6 ] ) >= tau_threshold and float( param_line.split("\t")[ 7 ] ) >= tau_threshold:
outlines_params.append( param_line )
outlines_stats.append( stats_line )
except ValueError:
outlines_params.append( param_line )
outlines_stats.append( stats_line )
print "retained: ", len(outlines_params)-1
with open("parameters.mig0_t5_p0.flexighosts.txt_filtered", "w") as OUTF:
OUTF.write("".join(outlines_params))
with open("ABCstat.mig0_t5_p0.flexighosts.txt_filtered", "w") as OUTF:
OUTF.write("".join(outlines_stats))
#######################################
## read
with open("parameters.mig0_t5_p0.txt", "r") as INF:
params = [x for x in INF]
with open("ABCstat.mig0_t5_p0.txt", "r") as INF:
stats = [x for x in INF]
outlines_params = []
outlines_stats = []
for param_line, stats_line in zip( params, stats ):
try:
if float( param_line.split("\t")[ 5 ] ) >= tau_threshold and float( param_line.split("\t")[ 5 ] ) >= tau_threshold:
outlines_params.append( param_line )
outlines_stats.append( stats_line )
except ValueError:
outlines_params.append( param_line )
outlines_stats.append( stats_line )
print "retained: ", len(outlines_params)-1
with open("parameters.mig0_t5_p0.txt_filtered", "w") as OUTF:
OUTF.write("".join(outlines_params))
with open("ABCstat.mig0_t5_p0.txt_filtered", "w") as OUTF:
OUTF.write("".join(outlines_stats))
#######################################
## read
with open("parameters.mig20_t5_p0.95.txt", "r") as INF:
params = [x for x in INF]
with open("ABCstat.mig20_t5_p0.95.txt", "r") as INF:
stats = [x for x in INF]
outlines_params = []
outlines_stats = []
for param_line, stats_line in zip( params, stats ):
try:
if float( param_line.split("\t")[ 5 ] ) >= tau_threshold and float( param_line.split("\t")[ 5 ] ) >= tau_threshold:
outlines_params.append( param_line )
outlines_stats.append( stats_line )
except ValueError:
outlines_params.append( param_line )
outlines_stats.append( stats_line )
print "retained: ", len(outlines_params)-1
with open("parameters.mig20_t5_p0.95.txt_filtered", "w") as OUTF:
OUTF.write("".join(outlines_params))
with open("ABCstat.mig20_t5_p0.95.txt_filtered", "w") as OUTF:
OUTF.write("".join(outlines_stats))