diff options
Diffstat (limited to '')
-rwxr-xr-x | tools/seqstat/seqstat.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/tools/seqstat/seqstat.py b/tools/seqstat/seqstat.py index 8450ec8..55b6ecc 100755 --- a/tools/seqstat/seqstat.py +++ b/tools/seqstat/seqstat.py @@ -4,12 +4,6 @@ import argparse ticks = ["▁", "▂", "▃", "▄", "▅", "▆", "▇", "█"] -parser = argparse.ArgumentParser() -parser.add_argument( - "numbers", metavar="N", type=float, nargs="+", help="a number for the accumulator" -) -args = parser.parse_args() - def histogram(sequence): min_val = min(sequence) @@ -22,5 +16,15 @@ def histogram(sequence): return [ticks[int((int(i - min_val) << 8) / scale)] for i in sequence] -h = histogram(args.numbers) -print("".join(h)) +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument( + "numbers", + metavar="N", + type=float, + nargs="+", + help="a number for the accumulator", + ) + args = parser.parse_args() + h = histogram(args.numbers) + print("".join(h)) |