changeset 63:0df8bcb6d521

stubbing: unicode histograms
author Jeff Hammel <k0scist@gmail.com>
date Thu, 26 Feb 2015 15:12:48 -0800
parents 18c0820bfe12
children 719029ee5e7b
files numerics/histogram.py setup.py
diffstat 2 files changed, 55 insertions(+), 0 deletions(-) [+]
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()
+
+
--- a/setup.py	Mon Feb 23 10:50:13 2015 -0800
+++ b/setup.py	Thu Feb 26 15:12:48 2015 -0800
@@ -17,6 +17,7 @@
     kw['entry_points'] = """
     [console_scripts]
     cat-columns = numerics.cat_columns:main
+    histogram = numerics.histogram:main
     interpolate = numerics.interpolation:main
     manipulate = numerics.manipulate:main
     plot = numerics.plot:main