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

Changed docs for actions_speeds_turns to state cm/frame and rad/frame instead of cm/s and rad/frame

parent 58b37a81
No related branches found
No related tags found
1 merge request!18Fixed internal issues with wrong conversions of speeds and turns.
...@@ -64,13 +64,13 @@ As described in `robofish.io`, Files and Entities have useful properties. ...@@ -64,13 +64,13 @@ As described in `robofish.io`, Files and Entities have useful properties.
<small> <small>
| Entity function | Description | | Entity function | Description |
| ------------------------------------------------ | ------------------------------------------------------------------------ | | ------------------------------------------------ | -------------------------------------------------------------------------------------- |
| `robofish.io.entity.Entity.positions` | Positions as a `(timesteps, 2 (x, y))` array. | | `robofish.io.entity.Entity.positions` | Positions as a `(timesteps, 2 (x, y))` array. |
| `robofish.io.entity.Entity.orientations` | Orientations as a `(timesteps, 2 (ori_x, ori_y))` array. | | `robofish.io.entity.Entity.orientations` | Orientations as a `(timesteps, 2 (ori_x, ori_y))` array. |
| `robofish.io.entity.Entity.orientations_rad` | Orientations as a `(timesteps, 1 (ori_rad))` array. | | `robofish.io.entity.Entity.orientations_rad` | Orientations as a `(timesteps, 1 (ori_rad))` array. |
| `robofish.io.entity.Entity.poses` | Poses as a `(timesteps, 4 (x, y, x_ori, y_ori))` array. | | `robofish.io.entity.Entity.poses` | Poses as a `(timesteps, 4 (x, y, x_ori, y_ori))` array. |
| `robofish.io.entity.Entity.poses_rad` | Poses as a `(timesteps, 3(x, y, ori_rad))` array. | | `robofish.io.entity.Entity.poses_rad` | Poses as a `(timesteps, 3(x, y, ori_rad))` array. |
| `robofish.io.entity.Entity.actions_speeds_turns` | Speed and turn as a `(timesteps - 1, 2 (speed_cm/s, turn_rad/s))` array. | | `robofish.io.entity.Entity.actions_speeds_turns` | Speed and turn as a `(timesteps - 1, 2 (speed in cm/frame, turn in rad/frame))` array. |
</small> </small>
......
...@@ -125,13 +125,13 @@ In the same scheme the following properties are available: ...@@ -125,13 +125,13 @@ In the same scheme the following properties are available:
<small> <small>
| File/ Entity function | Description | | File/ Entity function | Description |
| ----------------------------- | ------------------------------------------------------------------------------------ | | ----------------------------- | -------------------------------------------------------------------------------------------------- |
| *entity_*positions | Positions as a `(*entities*, timesteps, 2 (x, y))` arary. | | *entity_*positions | Positions as a `(*entities*, timesteps, 2 (x, y))` array. |
| *entity_*orientations | Orientations as a `(*entities*, timesteps, 2 (ori_x, ori_y))` arary. | | *entity_*orientations | Orientations as a `(*entities*, timesteps, 2 (ori_x, ori_y))` array. |
| *entity_*orientations_rad | Orientations as a `(*entities*, timesteps, 1 (ori_rad))` arary. | | *entity_*orientations_rad | Orientations as a `(*entities*, timesteps, 1 (ori_rad))` array. |
| *entity_*poses | Poses as a `(*entities*, timesteps, 4 (x, y, x_ori, y_ori))` array. | | *entity_*poses | Poses as a `(*entities*, timesteps, 4 (x, y, x_ori, y_ori))` array. |
| *entity_*poses_rad | Poses as a `(*entities*, timesteps, 3(x, y, ori_rad))` array. | | *entity_*poses_rad | Poses as a `(*entities*, timesteps, 3(x, y, ori_rad))` array. |
| *entity_*actions_speeds_turns | Speed and turn as a `(*entities*, timesteps - 1, 2 (speed_cm/s, turn_rad/s))` array. | | *entity_*actions_speeds_turns | Speed and turn as a `(*entities*, timesteps - 1, 2 (speed in cm/frame, turn in rad/frame))` array. |
</small> </small>
......
...@@ -241,15 +241,12 @@ class Entity(h5py.Group): ...@@ -241,15 +241,12 @@ class Entity(h5py.Group):
def actions_speeds_turns(self): def actions_speeds_turns(self):
"""Calculate the speed, turn and from the recorded positions and orientations. """Calculate the speed, turn and from the recorded positions and orientations.
The turn is calculated by the change of orientation. The turn is calculated by the change of orientation between frames.
The speed is calculated by the distance between the points, projected on the new orientation vector. The speed is calculated by the distance between the points, projected on the new orientation vector.
The sideway change of position cannot be represented with this method. The sideway change of position cannot be represented with this method.
Returns: Returns:
An array with shape (number_of_positions -1, 3). An array with shape (number_of_positions -1, 2 (speed in cm/frame, turn in rad/frame).
The first column is the speed (distance projected on new orientation).
The second column is the turning angle.
""" """
ori = self.orientations ori = self.orientations
......
...@@ -463,6 +463,15 @@ class File(h5py.File): ...@@ -463,6 +463,15 @@ class File(h5py.File):
@property @property
def entity_actions_speeds_turns(self): def entity_actions_speeds_turns(self):
"""Calculate the speed, turn and from the recorded positions and orientations.
The turn is calculated by the change of orientation between frames.
The speed is calculated by the distance between the points, projected on the new orientation vector.
The sideway change of position cannot be represented with this method.
Returns:
An array with shape (number_of_entities, number_of_positions -1, 2 (speed in cm/frame, turn in rad/frame).
"""
return self.select_entity_property( return self.select_entity_property(
None, entity_property=Entity.actions_speeds_turns None, entity_property=Entity.actions_speeds_turns
) )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment