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

Merge branch 'develop'

parents e62d5981 69e1c0de
No related branches found
No related tags found
No related merge requests found
Pipeline #37380 passed
# SPDX-License-Identifier: LGPL-3.0-or-later # SPDX-License-Identifier: LGPL-3.0-or-later
""" """
The Python package <a href="https://git.imp.fu-berlin.de/bioroboticslab/robofish/io">robofish.io</a> provides a simple interface to create, load, modify, and inspect files containing tracks of swarms. The Python package <a href="https://git.imp.fu-berlin.de/bioroboticslab/robofish/io">robofish.io</a> provides a simple interface to create, load, modify, and inspect files containing world information and movement tracks of entities (organisms, robots, obstacles,...).
The files are saved in the `.hdf5` format and following the [Track Format Specification](https://git.imp.fu-berlin.de/bioroboticslab/robofish/track_format/uploads/f76d86e7a629ca38f472b8f23234dbb4/RoboFish_Track_Format_-_1.0.pdf). The files are saved in the `.hdf5` format and following the [Track Format Specification](https://git.imp.fu-berlin.de/bioroboticslab/robofish/track_format/uploads/f76d86e7a629ca38f472b8f23234dbb4/RoboFish_Track_Format_-_1.0.pdf).
.. include:: ../../../docs/index.md .. include:: ../../../docs/index.md
......
...@@ -315,7 +315,7 @@ class File(h5py.File): ...@@ -315,7 +315,7 @@ class File(h5py.File):
Args: Args:
TODO TODO
category: the of the entity. The canonical values are ['fish', 'robot', 'obstacle']. category: the of the entity. The canonical values are ['organism', 'robot', 'obstacle'].
poses: optional two dimensional array, containing the poses of the entity (x,y,orientation_x, orientation_y). poses: optional two dimensional array, containing the poses of the entity (x,y,orientation_x, orientation_y).
poses_rad: optional two dimensional containing the poses of the entity (x,y, orientation_rad). poses_rad: optional two dimensional containing the poses of the entity (x,y, orientation_rad).
name: optional name of the entity. If no name is given, the is used with an id (e.g. 'fish_1') name: optional name of the entity. If no name is given, the is used with an id (e.g. 'fish_1')
...@@ -353,7 +353,7 @@ class File(h5py.File): ...@@ -353,7 +353,7 @@ class File(h5py.File):
"""Creates multiple entities. """Creates multiple entities.
Args: Args:
category: The common category for the entities. The canonical values are ['fish', 'robot', 'obstacle']. category: The common category for the entities. The canonical values are ['organism', 'robot', 'obstacle'].
poses: three dimensional array, containing the poses of the entity. poses: three dimensional array, containing the poses of the entity.
name: optional array of names of the entities. If no names are given, the category is used with an id (e.g. 'fish_1') name: optional array of names of the entities. If no names are given, the category is used with an id (e.g. 'fish_1')
outlines: optional array, containing the outlines of the entities, either a three dimensional common outline array can be given, or a four dimensional array. outlines: optional array, containing the outlines of the entities, either a three dimensional common outline array can be given, or a four dimensional array.
......
...@@ -6,9 +6,9 @@ import numpy as np ...@@ -6,9 +6,9 @@ import numpy as np
def test_entity_object(): def test_entity_object():
sf = robofish.io.File(world_size_cm=[100, 100], frequency_hz=25) sf = robofish.io.File(world_size_cm=[100, 100], frequency_hz=25)
f = sf.create_entity("fish", positions=[[10, 10]]) f = sf.create_entity("fish", positions=[[10, 10]])
assert type(f) == robofish.io.Entity assert type(f) == robofish.io.Entity, "Type of entity was wrong"
assert f.name == "fish_1" assert f.name == "fish_1", "Name of entity was wrong"
assert f.attrs["category"] == "fish" assert f.attrs["category"] == "fish", "category was wrong"
print(dir(f)) print(dir(f))
print(f["positions"]) print(f["positions"])
assert type(f["positions"]) == h5py.Dataset assert type(f["positions"]) == h5py.Dataset
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment