From a76fef04497ad948c93e9248e9d41f0005a4913b Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Mon, 25 Sep 2017 00:43:26 -0700 Subject: [PATCH] Improve error checking --- gridlock/grid.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gridlock/grid.py b/gridlock/grid.py index 8c9ac26..387f60d 100644 --- a/gridlock/grid.py +++ b/gridlock/grid.py @@ -317,6 +317,13 @@ class Grid(object): raise GridError('Misshapen shifts; second axis size should be 3,' ' shape is {}'.format(self.shifts.shape)) + if (numpy.abs(self.shifts) > 1).any(): + raise GridError('Only shifts in the range [-1, 1] are currently supported') + + if (self.shifts < 0).any(): + # TODO: Test negative shifts + warnings.warn('Negative shifts are still experimental and mostly untested, be careful!') + num_shifts = self.shifts.shape[0] if num_grids is None: num_grids = num_shifts