Mercurial > hg > numerics
changeset 66:7dd1b18c9f78
minor cleanup and better error
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sat, 28 Feb 2015 13:51:40 -0800 |
parents | 3f04d7ae4d69 |
children | a09d5ffd2fc9 |
files | numerics/interpolation.py setup.py tests/test_interpolation.py |
diffstat | 3 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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):
--- 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:
--- 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]