Mercurial > hg > numerics
diff numerics/histogram.py @ 63:0df8bcb6d521
stubbing: unicode histograms
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Thu, 26 Feb 2015 15:12:48 -0800 |
parents | |
children | 719029ee5e7b |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/numerics/histogram.py Thu Feb 26 15:12:48 2015 -0800 @@ -0,0 +1,54 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" + +Unicode is awesome; see http://www.alanwood.net/unicode/block_elements.html +""" + +blocks = """ +█ +▉ +▊ +▋ +▌ +▍ +▎ +▏ +""" + +# imports +import argparse +import os +import subprocess +import sys +import time +from .read import CSVParser + +# module globals +__all__ = ['HistogramParser', 'main'] + +class HistogramParser(argparse.ArgumentParser): + """histogram CLI option parser""" + + def __init__(self, **kwargs): + kwargs.setdefault('formatter_class', argparse.RawTextHelpFormatter) + kwargs.setdefault('description', __doc__) + argparse.ArgumentParser.__init__(self, **kwargs) + self.add_argument('-n', '--bins', dest='n_bins', type=int, + help="number of bins") + self.options = None + + +def main(args=sys.argv[1:]): + """CLI""" + + # parse command line options + parser = HistogramParser() + options = parser.parse_args(args) + + +if __name__ == '__main__': + main() + +