changeset 81:202ab51601b4

stub
author Jeff Hammel <k0scist@gmail.com>
date Sun, 01 Mar 2015 09:36:35 -0800
parents 8bfa28ff74ce
children 738a2400f0f3
files numerics/convert.py numerics/histogram.py
diffstat 2 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/numerics/convert.py	Sun Mar 01 09:29:38 2015 -0800
+++ b/numerics/convert.py	Sun Mar 01 09:36:35 2015 -0800
@@ -11,11 +11,18 @@
 from .data import transpose
 from .read import read_csv, CSVParser
 
-__all__ = ['cast', 'float_or_orig', 'main']
+__all__ = ['cast',
+           'float_or_orig',
+           'main']
 
 default_cast = (int, float, str)
 
 def cast(to_type, *values):
+    """
+    gently cast a thing to a thing;
+    if you can't, return the original value
+    """
+
 
     retval = []
     for value in values:
@@ -25,9 +32,15 @@
             retval.append(value)
     return retval
 
+def cast_or_discard(to_type, *values):
+    """
+    cast to `to_type` if possible;
+    otherwise just throw away
+    """
+    raise NotImplementedError('TODO') # -> record TODO items
 
 def float_or_orig(*values):
-    return cast([float], *values)
+    return cast(float, *values)
 
 
 def column_type(values, types=default_cast):
--- a/numerics/histogram.py	Sun Mar 01 09:29:38 2015 -0800
+++ b/numerics/histogram.py	Sun Mar 01 09:36:35 2015 -0800
@@ -104,6 +104,9 @@
     # transpose to columns
     columns = transpose(data)
 
+    # cast to float
+    import pdb; pdb.set_trace()
+
     # find min, max if not provided
     if options.min is None:
         options.min = min([min(column) for column in columns])