diff options
| author | KunoiSayami <[email protected]> | 2023-06-04 18:34:21 +0800 |
|---|---|---|
| committer | KunoiSayami <[email protected]> | 2023-06-04 18:34:21 +0800 |
| commit | 1fbb943005ad78335f0b921be516b3df8140406d (patch) | |
| tree | 454d384ed2566a907b11be57a6b7e49ddbc74605 /analysis0510.py | |
| parent | d8384bdc4aa7fa1ccc24aec296fac83f1d43a2b4 (diff) | |
Diffstat (limited to 'analysis0510.py')
| -rwxr-xr-x | analysis0510.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/analysis0510.py b/analysis0510.py index 59cc65c..78290ab 100755 --- a/analysis0510.py +++ b/analysis0510.py @@ -6,7 +6,7 @@ def read_from_line(line: str) -> dict[str, int | float]: ret = {} if 'skip:' in line: ret.update({'skip': int(line.split('skip:', 1)[1].split(',')[0])}) - ret.update({'sample': int(line.split('length:', 1)[1].split('|', 1)[0])}) + ret.update({'sample': int(line.split('length:', 1)[1].split('custom time:', 1)[0])}) ret.update({'custom': float(line.split('custom time: ', 1)[1].split('time')[0])}) ret.update({'normal': float(line.rsplit('time:', 1)[1])}) return ret @@ -30,6 +30,11 @@ def get_array_summary(sz: list[float]) -> tuple[str, str]: return f'{middle:.6f}', f'{avg:.6f}' +def calc_improve(element: list[int]) -> float: + a, b = list(map(float, element[:2])) + return a / b if a > b else b / a + + def read(file: str, need_calc: bool = False, output_latex: bool = False) -> None: items = {} with open(file) as fin: @@ -50,8 +55,9 @@ def read(file: str, need_calc: bool = False, output_latex: bool = False) -> None new_result[key][x].append(element[x]) print(*keys) for key, value in new_result.items(): - column = list(get_array_summary(value[x]) for x in keys) + column = list(get_array_summary(value[x])[1] for x in keys) if output_latex: + column.append(f'{calc_improve(column):.6f}') column = list(map(str, column)) column.insert(0, str(key)) print('\\hline\n', ' & '.join(column), '\\\\') |
