changeset 64:719029ee5e7b

stubbing
author Jeff Hammel <k0scist@gmail.com>
date Thu, 26 Feb 2015 15:48:19 -0800
parents 0df8bcb6d521
children 3f04d7ae4d69
files numerics/histogram.py
diffstat 1 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/numerics/histogram.py	Thu Feb 26 15:12:48 2015 -0800
+++ b/numerics/histogram.py	Thu Feb 26 15:48:19 2015 -0800
@@ -20,21 +20,30 @@
 # imports
 import argparse
 import os
-import subprocess
 import sys
 import time
 from .read import CSVParser
+from collections import OrderedDict
 
 # module globals
-__all__ = ['HistogramParser', 'main']
+__all__ = ['Histogram', 'HistogramParser', 'main']
+
+class Histogram(object):
+    """historgram"""
 
-class HistogramParser(argparse.ArgumentParser):
+    def __init__(self, bins):
+        bins = sorted(bin)
+        assert len(bins) > 1
+        self.histogram = self.OrderedDict(zip(bins[:-1],
+                                              bins[1:]))
+
+class HistogramParser(CSVParser):
     """histogram CLI option parser"""
 
     def __init__(self, **kwargs):
         kwargs.setdefault('formatter_class', argparse.RawTextHelpFormatter)
         kwargs.setdefault('description', __doc__)
-        argparse.ArgumentParser.__init__(self, **kwargs)
+        CSVParser..__init__(self, **kwargs)
         self.add_argument('-n', '--bins', dest='n_bins', type=int,
                           help="number of bins")
         self.options = None