Skip to content
Snippets Groups Projects
Commit fe5f3f76 authored by Andi Gerken's avatar Andi Gerken
Browse files

Optimized very slow validation routine.

parent 4a73d10d
Branches
Tags 0.2.15
No related merge requests found
Pipeline #48806 passed
......@@ -304,7 +304,8 @@ def validate_positions_range(world_size, positions, e_name):
# positions which are just a bit over the world edge are fine
error_allowance = 1.01
positions = np.array([p for p in positions if not any(np.isnan(p))])
# Remove rows where there is any nan
positions = np.array(positions)[~np.isnan(positions).any(axis=1)]
allowed_x = [
-1 * world_size[0] * error_allowance / 2,
......@@ -334,7 +335,9 @@ def validate_positions_range(world_size, positions, e_name):
def validate_orientations_length(orientations, e_name):
orientations = np.array([o for o in orientations if not any(np.isnan(o))])
# Remove rows where there is any nan
orientations = np.array(orientations)[~np.isnan(orientations).any(axis=1)]
ori_lengths = np.linalg.norm(orientations, axis=1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment