diff options
| author | KunoiSayami <[email protected]> | 2022-07-11 16:38:20 +0800 |
|---|---|---|
| committer | KunoiSayami <[email protected]> | 2022-07-11 16:38:20 +0800 |
| commit | f501587105cdfd823d43129f63e419a442871b65 (patch) | |
| tree | 6538cf2bd1ec5f847870cb175445c891dfce6c1d /ex_0702.py | |
| parent | 2c98458e2aa69e2af73e5536b46f5018dc402111 (diff) | |
feat(script): Add graphical output
Signed-off-by: KunoiSayami <[email protected]>
Diffstat (limited to 'ex_0702.py')
| -rwxr-xr-x | ex_0702.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/ex_0702.py b/ex_0702.py new file mode 100755 index 0000000..0a314d7 --- /dev/null +++ b/ex_0702.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 +import argparse +import subprocess + +import matplotlib.pyplot as plt + + +def function_pdf(proc: str): + p = subprocess.Popen([proc], stdin=subprocess.PIPE, stdout=subprocess.PIPE) + output, _ = p.communicate(b"1024 1024\n32768 1024\n32768 32768\n") + p.stdin.close() + for index in range(0, len(lines := output.splitlines()), 2): + plt.hist(list(map(int, lines[index].split())), bins=100) + plt.title(f"stddev: {lines[index + 1].decode()}") + plt.show() + + +if __name__ == '__main__': + parser = argparse.ArgumentParser() + parser.add_argument('proc') + matches = parser.parse_args() + function_pdf(matches.proc) |
