fix and improve error-checking for shifts parameter
This commit is contained in:
parent
a94a91446e
commit
e930baf2b4
@ -307,8 +307,11 @@ class Grid(object):
|
|||||||
self.periodic = periodic
|
self.periodic = periodic
|
||||||
|
|
||||||
self.shifts = numpy.array(shifts, dtype=float)
|
self.shifts = numpy.array(shifts, dtype=float)
|
||||||
|
if len(self.shifts.shape) != 2:
|
||||||
|
raise GridError('Misshapen shifts: shifts must have two axes! '
|
||||||
|
' The given shifts has shape {}'.format(self.shifts.shape))
|
||||||
if self.shifts.shape[1] != 3:
|
if self.shifts.shape[1] != 3:
|
||||||
GridError('Misshapen shifts; second axis size should be 3,'
|
raise GridError('Misshapen shifts; second axis size should be 3,'
|
||||||
' shape is {}'.format(self.shifts.shape))
|
' shape is {}'.format(self.shifts.shape))
|
||||||
|
|
||||||
num_shifts = self.shifts.shape[0]
|
num_shifts = self.shifts.shape[0]
|
||||||
|
Loading…
Reference in New Issue
Block a user