changeset 123:067705f465e8

we dont need a bunch of crap anymore, yay
author Jeff Hammel <k0scist@gmail.com>
date Mon, 16 Mar 2015 18:50:40 -0700
parents 19f3d071bb73
children 84baf80a5202
files numerics/mean.py
diffstat 1 files changed, 6 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/numerics/mean.py	Mon Mar 16 12:02:56 2015 -0700
+++ b/numerics/mean.py	Mon Mar 16 18:50:40 2015 -0700
@@ -12,7 +12,7 @@
 import sys
 from .data import transpose
 from .filters import mean
-from .read import CSVParser
+from .manipulate import ManipulationParser
 from .write import CSVWriter
 
 
@@ -20,22 +20,16 @@
     """CLI"""
 
     # parse command line options
-    parser = CSVParser()
+    parser = ManipulationParser()
+    parser.types = (float,)
     options = parser.parse_args(args)
 
     # read data
-    data = parser.read()
-    if not data:
+    columns = parser.typed_data()
+    if not columns:
         parser.error("No data given")
 
-    # transpose to columns
-    columns = transpose(data)
-
-    # cast to float
-    columns = [[float(value) for value in column]
-               for column in columns]
-
-    # means
+    # calculate means
     means = [mean(column) for column in columns]
 
     # write CSV