Skip to content
Snippets Groups Projects
Commit 2f348a3e authored by Bas Nijholt's avatar Bas Nijholt
Browse files

2D: use np.clip to simplify code

parent aff57461
No related branches found
No related tags found
1 merge request!7implement 2D learner
......@@ -767,8 +767,7 @@ class Learner2D(BaseLearner):
p, v, g, transform)
# Reduce to bounds
for j, (a, b) in enumerate(self.bounds):
point_new[j] = max(a, min(b, point_new[j]))
point_new = np.clip(point_new, *zip(*self.bounds))
# Check if it is really new (also, revert to mean point optionally)
if point_exists(point_new):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment