Mercurial > hg > numerics
diff numerics/interpolation.py @ 66:7dd1b18c9f78
minor cleanup and better error
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sat, 28 Feb 2015 13:51:40 -0800 |
parents | 2891db98a9b7 |
children |
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):