changeset 112:7578313b9fbf

hook up basic plumbing
author Jeff Hammel <k0scist@gmail.com>
date Sun, 15 Mar 2015 16:23:33 -0700
parents c4d26ef63d8e
children f9900883db2e
files numerics/bar.py numerics/convert.py numerics/read.py
diffstat 3 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/numerics/bar.py	Sun Mar 15 15:38:12 2015 -0700
+++ b/numerics/bar.py	Sun Mar 15 16:23:33 2015 -0700
@@ -10,14 +10,12 @@
 
 # imports
 import argparse
-import csv
-import os
 #import pandas as pd
 import sys
-from .read import CSVParser
+from .manipulate import ManipulationParser
+#from .read import CSVParser
 from bokeh.charts import Bar
 from bokeh.plotting import *
-from collections import OrderedDict
 
 __all__ = ['bar_chart', 'BarChartParser', 'main']
 
@@ -30,14 +28,13 @@
     bar.show()
 
 
-class BarChartParser(CSVParser):
+class BarChartParser(ManipulationParser):
     """command line options parser for bar charts"""
     # TODO: upstream to PlotParser
 
     def __init__(self, **kwargs):
-        kwargs.setdefault('formatter_class', argparse.RawTextHelpFormatter)
         kwargs.setdefault('description', __doc__)
-        CSVParser.__init__(self, **kwargs)
+        ManipulationParser.__init__(self, **kwargs)
         self.add_argument('-t', '--title', dest='title',
                           help="plot title")
 
@@ -49,6 +46,9 @@
     parser = BarChartParser()
     options = parser.parse_args(args)
 
+    # process data
+    data = parser.typed_data()
+
     # parse file
 #    data = pd.read_csv(options.input, header=None, names=options.columns, index_col=0)
 
--- a/numerics/convert.py	Sun Mar 15 15:38:12 2015 -0700
+++ b/numerics/convert.py	Sun Mar 15 16:23:33 2015 -0700
@@ -51,6 +51,7 @@
     return cast(float, *values)
     # convenience function ; do we need this?
 
+
 def column_type(values, types=default_cast):
     """determine the type of a column"""
     for t in types:
--- a/numerics/read.py	Sun Mar 15 15:38:12 2015 -0700
+++ b/numerics/read.py	Sun Mar 15 16:23:33 2015 -0700
@@ -93,6 +93,7 @@
 
     def __init__(self, **kwargs):
         kwargs.setdefault('description', __doc__)
+        kwargs.setdefault('formatter_class', argparse.RawTextHelpFormatter)
         argparse.ArgumentParser.__init__(self, **kwargs)
         self.add_argument('csv', nargs='*',
                           help="CSV files to read, or read from stdin")