Robofish IO
This repository implements an easy to use interface, to create, save, load, and work specification-compliant hdf5 files, containing 2D swarm data. This repository should be used by the different swarm projects to generate comparable standardized files.
Documentation
Installation
Add our Artifacts repository to your pip config and install the packagage.
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:
- Follow instructions at Artifacts repository
pip3 install robofish-io
Usage
We show a simple example below. More examples can be found in examples/
import robofish.io
import numpy as np
# Create a new robofish io file
f = robofish.io.File(world_size_cm=[100, 100], frequency_hz=25.0)
f.attrs["experiment_setup"] = "This is a simple example with made up data."
# Create a new robot entity. Positions and orientations are passed
# separately in this example. Since the orientations have two columns,
# unit vectors are assumed (orientation_x, orientation_y)
f.create_entity(
category="robot",
name="robot",
positions=np.zeros((100, 2)),
orientations=np.ones((100, 2)) * [0, 1],
)
# Create a new fish entity.
# In this case, we pass positions and orientations together (x, y, rad).
# Since it is a 3 column array, orientations in radiants are assumed.
poses = np.zeros((100, 3))
poses[:, 0] = np.arange(-50, 50)
poses[:, 1] = np.arange(-50, 50)
poses[:, 2] = np.arange(0, 2 * np.pi, step=2 * np.pi / 100)
fish = f.create_entity("fish", poses=poses)
fish.attrs["species"] = "My rotating spaghetti fish"
fish.attrs["fish_standard_length_cm"] = 10
# Show and save the file
print(f)
print("Poses Shape: ", f.entity_poses.shape)
f.save_as(path)
Evaluation
Evaluate your tracks with robofish-io-evaluate $mode $file(s)
Current modes are:
- speed
- turn
- tank_positions
- trajectories
- follow_iid
LICENSE
This work is licensed under LGPL 3.0 (or any later version). Individual files contain the following tag instead of the full license text:
SPDX-License-Identifier: LGPL-3.0-or-later
This enables machine processing of license information based on the SPDX License Identifiers available here: https://spdx.org/licenses/