Skip to content

Commit

Permalink
fix: adding checks for data size in interpolator
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlangrose committed Sep 27, 2022
1 parent ffe9614 commit ea8ccca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion LoopStructural/interpolators/_discrete_interpolator.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ def add_inequality_constraints_to_matrix(self, A, l, u, idc, name="undefined"):
self.ineq_constraints[name] = {"A": A, "l": l, "col": idc, "u": u, "row": rows}
self.ineq_const_c += idc.shape[0]

def add_inequality_feature(self, feature: BaseFeature, lower=True, mask=None):
def add_inequality_feature(self, feature, lower=True, mask=None):
"""Add an inequality constraint to the interpolator using an existing feature.
This will make the interpolator greater than or less than the exising feature.
Evaluate the feature at the interpolation nodes.
Expand Down
9 changes: 8 additions & 1 deletion LoopStructural/interpolators/_geological_interpolator.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ def set_value_constraints(self, points : np.ndarray):
-------
"""

if points.shape[1] < 4:
raise ValueError('Value points must at least have X,Y,Z,val')
self.data["value"] = points
self.n_i = points.shape[0]
self.up_to_date = False
Expand All @@ -102,6 +103,8 @@ def set_gradient_constraints(self, points : np.ndarray):
-------
"""
if points.shape[1] < 7:
raise ValueError('Gradient constraints must at least have X,Y,Z,gx,gy,gz')
self.n_g = points.shape[0]
self.data["gradient"] = points
self.up_to_date = False
Expand All @@ -119,6 +122,8 @@ def set_normal_constraints(self, points: np.ndarray):
-------
"""
if points.shape[1] < 7:
raise ValueError('Nonrmal constraints must at least have X,Y,Z,nx,ny,nz')
self.n_n = points.shape[0]
self.data["normal"] = points
self.up_to_date = False
Expand All @@ -136,6 +141,8 @@ def set_tangent_constraints(self, points: np.ndarray):
-------
"""
if points.shape[1] < 7:
raise ValueError('Tangent constraints must at least have X,Y,Z,tx,ty,tz')
self.data["tangent"] = points
self.up_to_date = False

Expand Down

0 comments on commit ea8ccca

Please sign in to comment.