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

Updated README

Added "all" mode to evaluation
parent 705cc264
No related branches found
No related tags found
No related merge requests found
......@@ -11,12 +11,15 @@
This repository implements an easy to use interface, to create, save, load, and work [specification-compliant](https://git.imp.fu-berlin.de/bioroboticslab/robofish/track_format) hdf5 files, containing 2D swarm data. This repository should be used by the different swarm projects to generate comparable standardized files.
## <a href="http://agerken.de/io/index.html">Documentation</a>
## Installation
Quick variant:
```
pip3 install robofish-trackviewer robofish-io --extra-index-url https://git.imp.fu-berlin.de/api/v4/projects/6392/packages/pypi/simple
Add our [Artifacts repository](https://git.imp.fu-berlin.de/bioroboticslab/robofish/artifacts) to your pip config and install the packagage.
```bash
python3 -m pip config set global.extra-index-url https://git.imp.fu-berlin.de/api/v4/projects/6392/packages/pypi/simple
python3 -m pip install robofish-io robofish-trackviewer
```
Better variant:
......
......@@ -11,6 +11,7 @@ Functions available to be used in the commandline to evaluate robofish.io files.
import robofish.evaluate
import argparse
from pathlib import Path
def function_dict():
......@@ -25,6 +26,7 @@ def function_dict():
"trajectories": base.evaluate_trajectories,
"evaluate_positionVec": base.evaluate_positionVec,
"follow_iid": base.evaluate_follow_iid,
"all": base.evaluate_all,
}
......@@ -86,6 +88,11 @@ def evaluate(args=None):
args = parser.parse_args()
if args.analysis_type in fdict:
fdict[args.analysis_type](args.paths, args.names, args.save_path)
params = (args.paths, args.names, Path(args.save_path))
if args.analysis_type == "all":
normal_functions = function_dict()
normal_functions.pop("all")
params += (normal_functions,)
fdict[args.analysis_type](*params)
else:
print(f"Evaluation function not found {args.analysis_type}")
......@@ -17,6 +17,7 @@ import numpy as np
import pandas as pd
from typing import Iterable
from scipy import stats
from tqdm import tqdm
def get_all_poses_from_paths(paths: Iterable[str]):
......@@ -669,7 +670,8 @@ def evaluate_follow_iid(
def evaluate_all(
paths: Iterable[str],
labels: Iterable[str] = None,
save_folder: str = None,
save_folder: Path = None,
fdict: dict = None,
predicate=None,
):
"""Generate all evaluation graphs and save them to a folder.
......@@ -679,23 +681,15 @@ def evaluate_all(
labels: Labels for the paths. If no labels are given, the paths will
be used
save_path: A path to a save location.
fdict: A dictionary of strings and evaluation functions
predicate: a lambda function, selecting entities
(example: lambda e: e.category == "fish")
"""
save_folder = Path(save_folder)
evaluate_speed(paths, labels, save_folder + "speed.png", predicate)
evaluate_turn(paths, labels, save_folder + "turn.png", predicate)
evaluate_orientation(paths, labels, save_folder + "orientation.png", predicate)
evaluate_relativeOrientation(
paths, labels, save_folder + "relativeOrientation.png", predicate
)
evaluate_distanceToWall(
paths, labels, save_folder + "distanceToWall.png", predicate
)
evaluate_tankpositions(paths, labels, save_folder + "tankpositions.png", predicate)
evaluate_trajectories(paths, labels, save_folder + "trajectories.png", predicate)
evaluate_positionVec(paths, labels, save_folder + "posVec.png", predicate)
evaluate_follow_iid(paths, labels, save_folder + "follow_iid.png", predicate)
t = tqdm(fdict.items(), desc="Evaluation", leave=True)
for f_name, f_callable in t:
t.set_description(f_name)
t.refresh() # to show immediately the update
f_callable(paths, labels, save_folder / (f_name + ".png"), predicate)
def calculate_follow(a, b):
......
......@@ -23,5 +23,6 @@ def test_app_validate():
self.save_path = graphics_out
for mode in app.function_dict().keys():
app.evaluate(DummyArgs(mode))
if mode != "all":
app.evaluate(DummyArgs(mode))
graphics_out.unlink()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment