From 79c40e50e6c77cbd96f6cba81e1247b5b7bbb9b6 Mon Sep 17 00:00:00 2001
From: Andi Gerken <andi.gerken@gmail.com>
Date: Tue, 22 Jun 2021 14:41:37 +0200
Subject: [PATCH] Changed wrong evaluation graphics. Changed pyproject to
 format correctly.

---
 pyproject.toml                    |  2 +-
 src/robofish/evaluate/evaluate.py | 19 +++++++++++++------
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/pyproject.toml b/pyproject.toml
index a762f8d..c3be3e3 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -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
diff --git a/src/robofish/evaluate/evaluate.py b/src/robofish/evaluate/evaluate.py
index 48f889b..d62c6ce 100644
--- a/src/robofish/evaluate/evaluate.py
+++ b/src/robofish/evaluate/evaluate.py
@@ -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()
 
-- 
GitLab