Check that distances are all positive

Co-authored-by: Ethan Peterson <ethan.peterson@mit.edu>
This commit is contained in:
Paul Romano 2023-04-24 10:53:00 -05:00 committed by GitHub
parent da24021119
commit 01cd2cc8dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1144,6 +1144,9 @@ class CruciformPrism(CompositeSurface):
@distances.setter
def distances(self, values):
values = np.array(values, dtype=float)
# check for positive values
if not (values > 0).all():
raise ValueError("distances must be positive")
# Check for monotonicity
if (values[1:] > values[:-1]).all() or (values[1:] < values[:-1]).all():
self._distances = values