# HG changeset patch # User Jeff Hammel # Date 1425160300 28800 # Node ID 7dd1b18c9f7854a3e06893c6c94696d424362d80 # Parent 3f04d7ae4d69cc55641e06c257aa478aa2de01d0 minor cleanup and better error diff -r 3f04d7ae4d69 -r 7dd1b18c9f78 numerics/interpolation.py --- a/numerics/interpolation.py Fri Feb 27 13:34:05 2015 -0800 +++ b/numerics/interpolation.py Sat Feb 28 13:51:40 2015 -0800 @@ -1,10 +1,10 @@ #!/usr/bin/env python - """ interpolation """ +# imports import argparse import sys @@ -58,8 +58,9 @@ nearest_neighbors = neighbors(points, x) # we don't support endpoints yet; this is interpolation, not extrapolation - assert not any([(neighbor[0] is None or neighbor[1] is None) - for neighbor in nearest_neighbors]) + if any([(neighbor[0] is None or neighbor[1] is None) + for neighbor in nearest_neighbors]): + raise AssertionError("Bad neighbors: {}".format(nearest_neighbors)) retval = [] for index, (left, right) in enumerate(nearest_neighbors): diff -r 3f04d7ae4d69 -r 7dd1b18c9f78 setup.py --- a/setup.py Fri Feb 27 13:34:05 2015 -0800 +++ b/setup.py Sat Feb 28 13:51:40 2015 -0800 @@ -27,7 +27,7 @@ types = numerics.convert:main """ # TODO: -# cleanse = numerics.clean:main +# cleanse = numerics.clean:main # cleans up outliers # fold = numerics.fold:main kw['install_requires'] = dependencies except ImportError: diff -r 3f04d7ae4d69 -r 7dd1b18c9f78 tests/test_interpolation.py --- a/tests/test_interpolation.py Fri Feb 27 13:34:05 2015 -0800 +++ b/tests/test_interpolation.py Sat Feb 28 13:51:40 2015 -0800 @@ -37,6 +37,7 @@ return retval def test_from_csv(self): + """test interpolation from a CSV file""" raw_data = self.read_test_data() data = [[(row[0], row[col]) for row in raw_data]