Skip to content

Commit 8a155f2

Browse files
committed
Correctly deal with 0 in quality distribution
1 parent 9871c01 commit 8a155f2

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

quality_distribution.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,25 @@ def compute(values, out):
2020
for i in range(len(res)):
2121
curr = float(total - running_total) / total
2222
if curr <= goal:
23-
out.write(str(res[i][0]) + " " + str(float(total - running_total) / total) + "\n")
23+
out.write(str(res[i][0] + 1 if res[i][0] != 0 else 1) + " " + str(float(total - running_total) / total) + "\n")
2424
goal -= 0.01
2525
running_total += res[i][1]
2626
# Consciously ignoring the last 1%
2727
out.write("\n")
2828

2929
done = { }
30+
threads = 0
3031

31-
with open(file) as file:
32-
lines = csv.reader(file)
32+
with open(file) as f:
33+
lines = csv.reader(f)
34+
for row in lines:
35+
threads = max(threads, int(row[1]))
36+
37+
with open(file) as f:
38+
lines = csv.reader(f)
3339
for row in lines:
3440
# We have enough data as-is, only use a single testrun
35-
if row[0] not in done:
41+
if int(row[1]) == threads and row[0] not in done:
3642
with open(row[0] + "_rank_error.txt", "w") as out:
3743
compute(row[5], out)
3844
with open(row[0] + "_delay.txt", "w") as out:

0 commit comments

Comments
 (0)