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

Changed wrong evaluation graphics.

Changed pyproject to format correctly.
parent 3b15ff80
No related branches found
No related tags found
1 merge request!18Fixed internal issues with wrong conversions of speeds and turns.
Pipeline #38492 passed
......@@ -8,7 +8,7 @@ extend-ignore = "E203"
[tool.black]
line-length = 88
include =''
include ='\.py'
[tool.pytest.ini_options]
filterwarnings = ["error"]
\ No newline at end of file
......@@ -73,11 +73,18 @@ def evaluate_speed(
"""
files_per_path = [robofish.io.read_multiple_files(p) for p in paths]
speeds = []
frequency = None
for k, files in enumerate(files_per_path):
path_speeds = []
for p, file in files.items():
assert frequency is None or frequency == file.frequency
frequency = file.frequency
for e_speeds_turns in file.entity_actions_speeds_turns:
path_speeds = np.concatenate([path_speeds, e_speeds_turns[:, 0]])
path_speeds = np.concatenate(
[path_speeds, e_speeds_turns[:, 0] * frequency]
)
speeds.append(path_speeds)
if labels is None:
......@@ -91,7 +98,7 @@ def evaluate_speed(
plt.title("Agent speeds")
plt.xlabel("Speed [cm/s]")
plt.ylabel("Frequency")
plt.ticklabel_format(useOffset=False)
plt.ticklabel_format(useOffset=False, style="plain")
plt.legend()
plt.tight_layout()
......@@ -130,14 +137,14 @@ def evaluate_turn(
frequency = file.frequency
for e_speeds_turns in file.entity_actions_speeds_turns:
path_turns.extend(e_speeds_turns[:, 1])
path_turns.extend(np.rad2deg(e_speeds_turns[:, 1]))
turns.append(path_turns)
if labels is None:
labels = paths
left_quantile = np.min(np.quantile(np.array(turns), 0.001, axis=1))
right_quantile = np.max(np.quantile(np.array(turns), 0.999, axis=1))
left_quantile = np.min(np.quantile(np.array(turns), 0.005, axis=1))
right_quantile = np.max(np.quantile(np.array(turns), 0.995, axis=1))
plt.hist(
turns,
bins=41,
......@@ -148,7 +155,7 @@ def evaluate_turn(
plt.title("Agent turns")
plt.xlabel("Change in orientation [Degree / timestep at %dhz]" % frequency)
plt.ylabel("Frequency")
plt.ticklabel_format(useOffset=False)
plt.ticklabel_format(useOffset=False, style="plain")
plt.legend()
# plt.tight_layout()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment