From 23654f4617012db9964406a0909e2dca90e467f2 Mon Sep 17 00:00:00 2001
From: Andi Gerken <andi.gerken@gmail.com>
Date: Fri, 1 Oct 2021 16:39:39 +0200
Subject: [PATCH] Fixed bug in evaluation scripts and added more tests.

---
 .gitignore                                   |   3 ++
 src/robofish/evaluate/evaluate.py            |  36 +++++++++++++------
 tests/resources/{valid.hdf5 => valid_1.hdf5} | Bin
 tests/resources/valid_2.hdf5                 | Bin 0 -> 15672 bytes
 tests/robofish/evaluate/test_app_evaluate.py |  11 +++---
 tests/robofish/evaluate/test_evaluate.py     |   2 +-
 tests/robofish/io/test_app_io.py             |  24 ++++++-------
 tests/robofish/io/test_file.py               |   2 +-
 tests/robofish/io/test_io.py                 |  26 +++++++-------
 9 files changed, 60 insertions(+), 44 deletions(-)
 rename tests/resources/{valid.hdf5 => valid_1.hdf5} (100%)
 create mode 100644 tests/resources/valid_2.hdf5

diff --git a/.gitignore b/.gitignore
index 3825a6a..764c5ec 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@ dist
 .vscode
 .venv
 .coverage
+.testmondata
 report.xml
 htmlcov
 html
@@ -16,5 +17,7 @@ env
 *.hdf5
 *.mp4
 
+!tests/resources/*.hdf5
+
 feature_requests.md
 output_graph.png
diff --git a/src/robofish/evaluate/evaluate.py b/src/robofish/evaluate/evaluate.py
index d62c6ce..aaa9645 100644
--- a/src/robofish/evaluate/evaluate.py
+++ b/src/robofish/evaluate/evaluate.py
@@ -73,6 +73,8 @@ def evaluate_speed(
     """
     files_per_path = [robofish.io.read_multiple_files(p) for p in paths]
     speeds = []
+    left_quantiles = []
+    right_quantiles = []
     frequency = None
 
     for k, files in enumerate(files_per_path):
@@ -82,19 +84,22 @@ def evaluate_speed(
             frequency = file.frequency
 
             for e_speeds_turns in file.entity_actions_speeds_turns:
-                path_speeds = np.concatenate(
-                    [path_speeds, e_speeds_turns[:, 0] * frequency]
-                )
+                path_speeds.extend(e_speeds_turns[:, 0] * frequency)
+
+        path_speeds = np.array(path_speeds)
+        left_quantiles.append(np.quantile(path_speeds, 0.001))
+        right_quantiles.append(np.quantile(path_speeds, 0.999))
         speeds.append(path_speeds)
 
     if labels is None:
         labels = paths
-    speeds = np.array(speeds)
-
-    left_quantile = np.min(np.quantile(speeds, 0.001, axis=1))
-    right_quantile = np.max(np.quantile(speeds, 0.999, axis=1))
 
-    plt.hist(list(speeds), bins=20, label=labels, range=[left_quantile, right_quantile])
+    plt.hist(
+        list(speeds),
+        bins=20,
+        label=labels,
+        range=[min(left_quantiles), max(right_quantiles)],
+    )
     plt.title("Agent speeds")
     plt.xlabel("Speed [cm/s]")
     plt.ylabel("Frequency")
@@ -132,25 +137,28 @@ def evaluate_turn(
     for k, files in enumerate(files_per_path):
 
         path_turns = []
+        left_quantiles, right_quantiles = [], []
         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_turns.extend(np.rad2deg(e_speeds_turns[:, 1]))
+
+        path_turns = np.array(path_turns)
+        left_quantiles.append(np.quantile(path_turns, 0.001))
+        right_quantiles.append(np.quantile(path_turns, 0.999))
         turns.append(path_turns)
 
     if labels is None:
         labels = paths
 
-    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,
         label=labels,
         density=True,
-        range=[left_quantile, right_quantile],
+        range=[min(left_quantiles), max(right_quantiles)],
     )
     plt.title("Agent turns")
     plt.xlabel("Change in orientation [Degree / timestep at %dhz]" % frequency)
@@ -697,6 +705,12 @@ def evaluate_all(
         predicate: a lambda function, selecting entities
             (example: lambda e: e.category == "fish")
     """
+    assert (
+        save_folder is not None and save_folder != ""
+    ), "Please provide a save_folder using --save_path"
+
+    save_folder.mkdir(exist_ok=True)
+
     t = tqdm(fdict.items(), desc="Evaluation", leave=True)
     for f_name, f_callable in t:
         t.set_description(f_name)
diff --git a/tests/resources/valid.hdf5 b/tests/resources/valid_1.hdf5
similarity index 100%
rename from tests/resources/valid.hdf5
rename to tests/resources/valid_1.hdf5
diff --git a/tests/resources/valid_2.hdf5 b/tests/resources/valid_2.hdf5
new file mode 100644
index 0000000000000000000000000000000000000000..10caedaafa4d0d13c4be720f2c8d48dec184a092
GIT binary patch
literal 15672
zcmeD5aB<`1lHy_j0S*oZ76t(j3y%LofrTwZ2+I8r;W02IKpBisx&unDV1h6h8Q2&=
zauN_Og8<Zg1!jnV21t^DfgvQw)s=yPkpX5tjE1OUU|@h60Hxr<ql}Re0v@i80U)17
zfCvT#1`Q~E0-DaCT!z%VlFX9K)M6OFI5D>%Co?Y{CIC%t3<fX-1ZY8MdPPsyJPZL0
zEDWF&%f}$XAi+?cUzC#)Uz}N$8lRlYz`!7=AP<&jU{GKX=U@=8huXu)2yp?-*)W=c
z;e-<i^DuaT^)WK=Gw?7-Fr?)d<tCQIm!%dJXXfWIFbHrkfaO8vf{esv9>f*~284Os
z3?d91F!M@_azMHn7$g}P!9E1#dWaqlumpt7zyJ<(h!8j*Gk{ftm7oxe3?K;4rVOxf
zD*y!&0|UbZHi&XU`TT|wL><UI5Y{L;l0pDIpTo-g4bb!h3yZYO;*5Ah1_m%~1j>gH
z83zbOGRerm0#4sB`(X9d0eOf~4G@X}-F>ih8o&-!0Husf6*8*8<pV^(145Ba;&Pt{
z)O{6DlX0n2P=P3b`2)gZU~qT#_W|d1s7JtT257!#U|`57DJdwn($`PVEYZu%EznCV
z)lEt*%E`>rOG(vF%FHjyPs%UJOfJqzOwtFjLGhtqQk0mS9S<qG^mX-%Qgc!hi&KmB
z4fPCQ<sB>30kCj_HV2?(8zf#qN}$CDhB!zLggy8{<R~5ufzc2c4S~@R7!85Z5Eu=C
z(GVC7fzc2c4S~@R7!85Z5Wp7#!G8WOj0{W+&>=ns4`_!QHV%M3eg_*L;ed{Jz|?t2
zLToXBibHrKha@zv$sh*_3s^Wqc%$S<2?0p@V8A`UHBtg%)Sp;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sK?d!fs-_ufdUv$y7X
zy0>dmwf)lhw)>oItL%?3MeK`FuD1U<&uw3sXo>xk<XQWyCS}`y&OWhkw|s#8dI8b>
zmsxG>@9x&!KR;X3Uj4QG{-)is_W6rE_oqGKw?DW$c)xV0n*FtzPWvmSO53yhc<--q
zd}U|6D0%;%^0#&e&m`?<VEbT~sF1XOqryA8<^@UnueWg7*La5SKX*yOJ|NL|zv(;<
z`$_c?`%f3i*gsq7wf}^&mi;$(`~6K5B<<&2_Ss)||B>C*y43wHtlf4m6U+9uTc5Xk
zB%ZaOTd>Q{rloAZW>mIaziQ=vX@fw!k29<GKlYwxcWg(=ei63Ub}jkI`_F&=U?=x5
zaliK7opuxZ^Y$lx*=VQERj_|~#3{S08rl0zT)FLS&xY;)=cZ==bg9$+JGFfF8`g&G
zk5&I>Cs3KNU+c(6yZn`j`&}LG*x5;??-xm4Z}+>YVE-bC47<#*%KfJ*-0dbwRPR@6
z<*@s<t#-fny3Mwp%=P;ZM;6;0{ZYT)V_Vmr+288-i=DLHJ9lUO{)CNrwhJfJ@9(^r
zWj9y1a(~vOOLn&-GWV-7ez&u<P1qk-@x!j}YW)6P`}W&yjLY56%P44X_A_XI-#k|P
zc`;G@<=_9blgN$V|KREqJ4U9|{hGqF?97x(_VY~KWXJzDf4|12+jhJ*>HFCm*4u5a
zE!gk7$HvZbZuNdamQ1_#9+mqSu`aZm&s4nMY}$0Yi>)R5^AAq4({w7`&+dEIj`ddB
FegGz!7+C-S

literal 0
HcmV?d00001

diff --git a/tests/robofish/evaluate/test_app_evaluate.py b/tests/robofish/evaluate/test_app_evaluate.py
index d7b783f..ac3d8c0 100644
--- a/tests/robofish/evaluate/test_app_evaluate.py
+++ b/tests/robofish/evaluate/test_app_evaluate.py
@@ -9,7 +9,8 @@ np.seterr(all="raise")
 
 logging.getLogger().setLevel(logging.INFO)
 
-h5py_file = utils.full_path(__file__, "../../resources/valid.hdf5")
+h5py_file_1 = utils.full_path(__file__, "../../resources/valid_1.hdf5")
+h5py_file_2 = utils.full_path(__file__, "../../resources/valid_2.hdf5")
 
 
 def test_app_validate(tmp_path):
@@ -24,10 +25,10 @@ def test_app_validate(tmp_path):
 
     for mode in app.function_dict().keys():
         if mode == "all":
-            app.evaluate(DummyArgs(mode, [h5py_file], tmp_path))
-            app.evaluate(DummyArgs(mode, [h5py_file, h5py_file], tmp_path))
+            app.evaluate(DummyArgs(mode, [h5py_file_1], tmp_path))
+            app.evaluate(DummyArgs(mode, [h5py_file_2, h5py_file_2], tmp_path))
         else:
-            app.evaluate(DummyArgs(mode, [h5py_file], tmp_path / "image.png"))
+            app.evaluate(DummyArgs(mode, [h5py_file_1], tmp_path / "image.png"))
             app.evaluate(
-                DummyArgs(mode, [h5py_file, h5py_file], tmp_path / "image.png")
+                DummyArgs(mode, [h5py_file_2, h5py_file_2], tmp_path / "image.png")
             )
diff --git a/tests/robofish/evaluate/test_evaluate.py b/tests/robofish/evaluate/test_evaluate.py
index 65aa727..0476c18 100644
--- a/tests/robofish/evaluate/test_evaluate.py
+++ b/tests/robofish/evaluate/test_evaluate.py
@@ -5,7 +5,7 @@ import numpy as np
 
 
 def test_get_all_poses_from_paths():
-    valid_file_path = utils.full_path(__file__, "../../resources/valid.hdf5")
+    valid_file_path = utils.full_path(__file__, "../../resources/valid_1.hdf5")
     poses, frequency = robofish.evaluate.get_all_poses_from_paths([valid_file_path])
 
     # (1 input array, 1 file, 2 fishes, 100 timesteps, 4 poses)
diff --git a/tests/robofish/io/test_app_io.py b/tests/robofish/io/test_app_io.py
index 6ac9561..31ca2de 100644
--- a/tests/robofish/io/test_app_io.py
+++ b/tests/robofish/io/test_app_io.py
@@ -7,34 +7,32 @@ from pathlib import Path
 logging.getLogger().setLevel(logging.INFO)
 
 
+resources_path = utils.full_path(__file__, "../../resources")
+h5py_file = utils.full_path(__file__, "../../resources/valid_1.hdf5")
+
+
 def test_app_validate():
-    """ This tests the function of the robofish-io-validate command """
+    """This tests the function of the robofish-io-validate command"""
 
     class DummyArgs:
         def __init__(self, path, output_format):
             self.path = path
             self.output_format = output_format
 
-    raw_output = app.validate(
-        DummyArgs(utils.full_path(__file__, "../../resources"), "raw")
-    )
+    raw_output = app.validate(DummyArgs(resources_path, "raw"))
 
     # The three files valid.hdf5, almost_valid.hdf5, and invalid.hdf5 should be found.
-    assert len(raw_output) == 2
-    app.validate(DummyArgs(utils.full_path(__file__, "../../resources"), "human"))
+    assert len(raw_output) == 3
+    app.validate(DummyArgs(resources_path, "human"))
 
 
 def test_app_print():
-    """ This tests the function of the robofish-io-validate command """
+    """This tests the function of the robofish-io-validate command"""
 
     class DummyArgs:
         def __init__(self, path, output_format):
             self.path = path
             self.output_format = output_format
 
-    app.print_file(
-        DummyArgs(utils.full_path(__file__, "../../resources/valid.hdf5"), "full")
-    )
-    app.print_file(
-        DummyArgs(utils.full_path(__file__, "../../resources/valid.hdf5"), "shape")
-    )
+    app.print_file(DummyArgs(h5py_file, "full"))
+    app.print_file(DummyArgs(h5py_file, "shape"))
diff --git a/tests/robofish/io/test_file.py b/tests/robofish/io/test_file.py
index 97e2aa1..2ec1f26 100644
--- a/tests/robofish/io/test_file.py
+++ b/tests/robofish/io/test_file.py
@@ -10,7 +10,7 @@ import logging
 
 LOGGER = logging.getLogger(__name__)
 
-valid_file_path = utils.full_path(__file__, "../../resources/valid.hdf5")
+valid_file_path = utils.full_path(__file__, "../../resources/valid_1.hdf5")
 
 
 def test_constructor():
diff --git a/tests/robofish/io/test_io.py b/tests/robofish/io/test_io.py
index 3a7bb32..0cd1c80 100644
--- a/tests/robofish/io/test_io.py
+++ b/tests/robofish/io/test_io.py
@@ -5,6 +5,10 @@ from pathlib import Path
 import numpy as np
 
 
+resources_path = utils.full_path(__file__, "../../resources/")
+h5py_file = utils.full_path(__file__, "../../resources/valid_1.hdf5")
+
+
 def test_now_iso8061():
     # Example time: 2021-01-05T14:33:40.401000+00:00
     time = robofish.io.now_iso8061()
@@ -13,12 +17,12 @@ def test_now_iso8061():
 
 
 def test_read_multiple_single():
-    path = utils.full_path(__file__, "../../resources/valid.hdf5")
+    path = h5py_file
 
     # Variants path as posix path or as string
     for sf in [
-        robofish.io.read_multiple_files(path),
-        robofish.io.read_multiple_files(str(path)),
+        robofish.io.read_multiple_files(h5py_file),
+        robofish.io.read_multiple_files(str(h5py_file)),
     ]:
         assert len(sf) == 1
         for p, f in sf.items():
@@ -27,27 +31,23 @@ def test_read_multiple_single():
 
 
 def test_read_multiple_folder():
-    path = utils.full_path(__file__, "../../resources/")
-
     # Variants path as posix path or as string
     for sf in [
-        robofish.io.read_multiple_files(path),
-        robofish.io.read_multiple_files(str(path)),
+        robofish.io.read_multiple_files(resources_path),
+        robofish.io.read_multiple_files(str(resources_path)),
     ]:
         # Should find the 3 presaved hdf5 files
-        assert len(sf) == 2
+        assert len(sf) == 3
         for p, f in sf.items():
             print(p)
             assert type(f) == robofish.io.File
 
 
-path = utils.full_path(__file__, "../../resources/valid.hdf5")
-
 # TODO read from folder of valid files
-@pytest.mark.parametrize("_path", [path, str(path)])
-def test_read_poses_rad_from_multiple_folder(_path):
+@pytest.mark.parametrize("param_path", [h5py_file, str(h5py_file)])
+def test_read_poses_rad_from_multiple_folder(param_path):
     poses = robofish.io.read_property_from_multiple_files(
-        [_path, _path], robofish.io.entity.Entity.poses_rad
+        [param_path, param_path], robofish.io.entity.Entity.poses_rad
     )
     # Should find the 3 presaved hdf5 files
     assert len(poses) == 2
-- 
GitLab