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

Fixed follow_iid plots. Fixed validation to allow np.nan

parent d5a55c3c
Branches
Tags 0.2.8
No related merge requests found
Pipeline #48436 passed
...@@ -504,12 +504,20 @@ def evaluate_follow_iid( ...@@ -504,12 +504,20 @@ def evaluate_follow_iid(
calculate_follow(poses[i, :, 0:2], all_poses[j, :, 0:2]) calculate_follow(poses[i, :, 0:2], all_poses[j, :, 0:2])
) )
file.close() file.close()
follow.append(path_follow) follow.append(np.array(path_follow))
iid.append(path_iid) iid.append(np.array(path_iid))
grids = [] grids = []
worldBoundsX, worldBoundsY = max(worldBoundsX), max(worldBoundsY) worldBoundsX, worldBoundsY = max(worldBoundsX), max(worldBoundsY)
maxDist = (worldBoundsX ** 2 + worldBoundsY ** 2) ** (1 / 2)
follow_flat = np.concatenate([f.flatten() for f in follow])
iid_flat = np.concatenate([i.flatten() for i in iid])
# Find the 0.5%/ 99.5% quantiles as min and max for the axis
follow_range = np.max(
[-1 * np.quantile(follow_flat, 0.005), np.quantile(follow_flat, 0.995)]
)
max_iid = np.quantile(iid_flat, 0.995)
for i in range(len(follow)): for i in range(len(follow)):
follow_iid_data = pd.DataFrame( follow_iid_data = pd.DataFrame(
...@@ -524,10 +532,12 @@ def evaluate_follow_iid( ...@@ -524,10 +532,12 @@ def evaluate_follow_iid(
x="IID [cm]", x="IID [cm]",
y="Follow", y="Follow",
data=follow_iid_data, data=follow_iid_data,
linewidth=0, kind="hist",
kind="scatter", xlim=(0, max_iid),
xlim=(0, maxDist), ylim=(-follow_range, follow_range),
ylim=(-5, 5), cbar=True,
legend=True,
joint_kws={"bins": 50},
) )
grid.fig.set_figwidth(9) grid.fig.set_figwidth(9)
grid.fig.set_figheight(6) grid.fig.set_figheight(6)
......
...@@ -304,6 +304,8 @@ def validate_positions_range(world_size, positions, e_name): ...@@ -304,6 +304,8 @@ def validate_positions_range(world_size, positions, e_name):
# positions which are just a bit over the world edge are fine # positions which are just a bit over the world edge are fine
error_allowance = 1.01 error_allowance = 1.01
positions = np.array([p for p in positions if not any(np.isnan(p))])
allowed_x = [ allowed_x = [
-1 * world_size[0] * error_allowance / 2, -1 * world_size[0] * error_allowance / 2,
world_size[0] * error_allowance / 2, world_size[0] * error_allowance / 2,
...@@ -332,12 +334,9 @@ def validate_positions_range(world_size, positions, e_name): ...@@ -332,12 +334,9 @@ def validate_positions_range(world_size, positions, e_name):
def validate_orientations_length(orientations, e_name): def validate_orientations_length(orientations, e_name):
ori_lengths = np.linalg.norm(orientations, axis=1) orientations = np.array([o for o in orientations if not any(np.isnan(o))])
# import matplotlib.pyplot as plt ori_lengths = np.linalg.norm(orientations, axis=1)
#
# plt.plot(ori_lengths)
# plt.show()
# Check if all orientation lengths are all 1. Different lengths cause warnings. # Check if all orientation lengths are all 1. Different lengths cause warnings.
assert_validate( assert_validate(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment