|
4 | 4 | CALC_NAMES = ['FP', 'FN', 'TP'] |
5 | 5 |
|
6 | 6 | projects = [ |
7 | | - ('Convex', 'artifacts/experiment/rq1_convex.csv', 'artifacts/experiment/rq1_table_convex.tex'), |
8 | | - ('jFlex', 'artifacts/experiment/rq1_jflex.csv', 'artifacts/experiment/rq1_table_jflex.tex'), |
9 | | - ('MPH Table', 'artifacts/experiment/rq1_mph-table.csv', 'artifacts/experiment/rq1_table_mph-table.tex'), |
10 | | - ('RPKI-Commons', 'artifacts/experiment/rq1_rpki-commons.csv', 'artifacts/experiment/rq1_table_rpki-commons.tex'), |
| 7 | + ('convex', 'artifacts/experiment/rq1_convex.csv', 'artifacts/experiment/rq1_table_convex.tex'), |
| 8 | + ('jflex', 'artifacts/experiment/rq1_jflex.csv', 'artifacts/experiment/rq1_table_jflex.tex'), |
| 9 | + ('mphtable', 'artifacts/experiment/rq1_mph-table.csv', 'artifacts/experiment/rq1_table_mph-table.tex'), |
| 10 | + ('rpkicommons', 'artifacts/experiment/rq1_rpki-commons.csv', 'artifacts/experiment/rq1_table_rpki-commons.tex'), |
11 | 11 | ] |
12 | 12 |
|
13 | 13 | byProjNameFile = 'artifacts/experiment/rq1_table_projects.tex' |
|
54 | 54 | data['Property'] = data['entryPoint'].apply(lambda v: shortNames[v]) |
55 | 55 |
|
56 | 56 | df = data[['Property', 'FP', 'FN', 'TP']].groupby(by='Property').sum().round(2) |
| 57 | + df['+Ratio'] = df['FP'] / df['TP'] |
57 | 58 | df['N'] = pd.RangeIndex(start=rowCount, stop=len(df.index) + rowCount) |
58 | 59 | df.reset_index(inplace=True) |
59 | | - dfSubset = df[['N', 'Property', 'FP', 'FN', 'TP']] |
| 60 | + dfSubset = df[['N', 'Property', 'FP', 'FN', 'TP', '+Ratio']] |
60 | 61 |
|
61 | 62 | rowCount = len(df.index) + rowCount |
62 | 63 | dataSetSum[projName] = dfSubset.copy() |
|
86 | 87 | projName = project[0] |
87 | 88 | dataSetSum[projName]['_style'] = '' |
88 | 89 |
|
89 | | - projMean = dataSetSum[projName][CALC_NAMES].mean() |
| 90 | + projMean = dataSetSum[projName][CALC_NAMES].mean().round() |
90 | 91 | projMean['_style'] = 'BOLD' |
91 | 92 | projMean['N'] = '' |
92 | 93 | projMean['Property'] = 'Average' |
| 94 | + projMean['+Ratio'] = projMean['FP'] / projMean['TP'] |
93 | 95 | dataSetSum[projName].loc['mean'] = projMean |
94 | 96 |
|
95 | | - header = dict(zip(['N', 'Property', 'FP', 'FN', 'TP'], ['', '', '', '', ''])) |
| 97 | + header = dict(zip(['N', 'Property', 'FP', 'FN', 'TP', '+Ratio'], ['', '', '', '', '', ''])) |
96 | 98 |
|
97 | 99 | newDF = pd.concat([ |
98 | 100 | newDF, |
99 | 101 | pd.DataFrame(header | {'_style': 'HEADER', 'Property': projName}, index=[0]), # project header |
100 | 102 | dataSetSum[projName] # project data / avg |
101 | 103 | ], ignore_index=True) |
102 | 104 |
|
103 | | - # header_rows = newDF[newDF['N'] == '0HEADER'].index |
104 | 105 | bold_rows = newDF[ newDF['_style'] == 'BOLD' ].index |
105 | 106 | header_rows = newDF[ newDF['_style'] == 'HEADER' ].index |
106 | 107 |
|
107 | 108 | latexTable = newDF \ |
108 | 109 | .drop(columns=['_style']) \ |
109 | 110 | .style \ |
110 | 111 | .hide(axis=0) \ |
111 | | - .format(precision=2) \ |
| 112 | + .format(precision=0) \ |
112 | 113 | .set_properties(subset=pd.IndexSlice[header_rows, :], **{'HEADER': ''}) \ |
113 | 114 | .set_properties(subset=pd.IndexSlice[bold_rows, :], **{'textbf': '--rwrap'}) \ |
114 | | - .to_latex(hrules=False) |
| 115 | + .format(subset=pd.IndexSlice['+Ratio'], precision=2) \ |
| 116 | + .to_latex(hrules=False, column_format="llrrrr") |
115 | 117 |
|
116 | 118 | outTable = '' |
117 | 119 |
|
|
123 | 125 | possibleCommand = s[0].strip() |
124 | 126 |
|
125 | 127 | if possibleCommand == '\HEADER': |
126 | | - outTable += '\\hline' + "\n" + '\multicolumn{' + c + '}{c}{' + s[1].strip()[7:].strip() + '}' + " \\\\\n" + '\\hline' + "\n" |
| 128 | + outTable += '\\hline' + "\n" + '\multicolumn{' + c + '}{c}{\\' + s[1].strip()[7:].strip() + '}' + " \\\\\n" + '\\hline' + "\n" |
127 | 129 | else: |
128 | 130 | outTable += line |
129 | 131 |
|
|
0 commit comments