diff options
| author | KunoiSayami <[email protected]> | 2023-05-15 01:59:43 +0800 |
|---|---|---|
| committer | KunoiSayami <[email protected]> | 2023-05-15 01:59:43 +0800 |
| commit | 4afec90b7e4c45e8878c677ec77d4f8b1d522df9 (patch) | |
| tree | 334137b57dd3bd44332a3dc19b2aa3afd61341a6 /analysis0510.py | |
| parent | ce670dbc723df4988f9be7b2704f97066dfeec4c (diff) | |
feat(exp): Add analysis script
Signed-off-by: KunoiSayami <[email protected]>
Diffstat (limited to 'analysis0510.py')
| -rwxr-xr-x | analysis0510.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/analysis0510.py b/analysis0510.py new file mode 100755 index 0000000..b51fc8c --- /dev/null +++ b/analysis0510.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python +import argparse + + +def read_from_line(line: str) -> dict[str, int | float]: + ret = {} + if 'skip:' in line: + ret.update({'skip': int(line.split('skip:', 2)[1].split(',')[0])}) + ret.update({'sample': int(line.split('length:', 2)[1].split('|', 2)[0])}) + ret.update({'custom': float(line.split('custom time: ', 2)[1].split('time')[0])}) + ret.update({'normal': float(line.rsplit('time:', 2)[1])}) + return ret + + +def read(file: str) -> None: + items = {} + with open(file) as fin: + while s := fin.readline(): + element = read_from_line(s) + if (sample := element['sample']) not in items: + items.update({sample: []}) + items[sample].append(element) + print(items) + + +if __name__ == '__main__': + arg_ = argparse.ArgumentParser() + arg_.add_argument("file") + read(arg_.parse_args().file) |
