Add a column with average value of input files.

Gather the averages of the non-reference files.
This commit is contained in:
Lauro Moura 2019-04-24 16:07:50 -03:00
parent a873c115e0
commit 908c95ba85
1 changed files with 13 additions and 0 deletions

View File

@ -7,6 +7,7 @@ import os
import os.path import os.path
import csv import csv
from optparse import OptionParser from optparse import OptionParser
from collections import defaultdict
fmttext = '%(value)7.2f (%(percentual)+6.1f%%)' fmttext = '%(value)7.2f (%(percentual)+6.1f%%)'
fmthtml = '%(value)7.2f <span style="color: #666; width: 55pt; display: inline-block; text-align: right; text-shadow: #999 1px 1px 3px;">(%(percentual)+0.1f%%)</span>' fmthtml = '%(value)7.2f <span style="color: #666; width: 55pt; display: inline-block; text-align: right; text-shadow: #999 1px 1px 3px;">(%(percentual)+0.1f%%)</span>'
@ -64,6 +65,17 @@ for f in files:
d[t] = float(row[0]) d[t] = float(row[0])
max_test_name = max(len(t), max_test_name) max_test_name = max(len(t), max_test_name)
# Insert averages
data['average'] = defaultdict(list)
for f in others_f:
for test in data[f]:
data['average'][test].append(data[f][test])
for test in data['average']:
values = data['average'][test]
data['average'][test] = sum(values)/len(values)
others_f.insert(0, 'average')
def report_text(): def report_text():
test_name_fmt = "%%%ds:" % max_test_name test_name_fmt = "%%%ds:" % max_test_name
@ -126,6 +138,7 @@ def report_html():
import time import time
fnames = [os.path.basename(f) for f in files] fnames = [os.path.basename(f) for f in files]
fnames.insert(1, 'Average')
print("""\ print("""\
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">