changeset 76:7faa0112ef9f

much of CLI
author Jeff Hammel <k0scist@gmail.com>
date Sun, 01 Mar 2015 08:51:45 -0800
parents 2337abc4ebfe
children dcfce20597a6
files numerics/histogram.py
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/numerics/histogram.py	Sun Mar 01 08:23:18 2015 -0800
+++ b/numerics/histogram.py	Sun Mar 01 08:51:45 2015 -0800
@@ -46,6 +46,11 @@
             for vmin, vmax in self.data.keys():
                 if vmin <= value < vmax:
                     self.data[(vmin, vmax)].append(value)
+                    break
+            else:
+                if value == vmax:
+                    # handle rightmost endpoint
+                    self.data[(vmin, vmax)].append(value
 
     def __iadd__(self, value):
         self.add(value)
@@ -77,6 +82,10 @@
         CSVParser.__init__(self, **kwargs)
         self.add_argument('-n', '--bins', dest='n_bins', type=int,
                           help="number of bins")
+        self.add_argument('--min', dest='min', type=float,
+                          help="minimum value; else taken from data")
+        self.add_argument('--max', dest='max', type=float,
+                          help="maximum value, else taken from data")
         self.options = None
 
 
@@ -95,7 +104,6 @@
     # transpose to columns
     columns = transpose(data)
 
+
 if __name__ == '__main__':
     main()
-
-