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

Changed all typos "radiants" to "radians". Solving issue #17.

parent c5b26ddb
No related branches found
No related tags found
1 merge request!19Changed all typos "radiants" to "radians". Solving issue #17.
Pipeline #39321 failed
......@@ -46,7 +46,7 @@ f.create_entity(
# Create a new fish entity with 10 timesteps.
# In this case, we pass positions and orientations together (x, y, rad).
# Since it is a 3 column array, orientations in radiants are assumed.
# Since it is a 3 column array, orientations in radians are assumed.
poses = np.zeros((10, 3))
poses[:, 0] = np.arange(-5, 5)
poses[:, 1] = np.arange(-5, 5)
......
......@@ -23,7 +23,7 @@ ori_rad = np.zeros((100,1))
f.create_entity(category="fish", positions=pos)
# Creating an entity using orientation vectors. Keeping the entity object is not neccessary, it is saved in the file.
f.create_entity(category="fish", positions=pos, orientations=ori_vec)
# Creating an entity using radiant orientations.
# Creating an entity using radian orientations.
f.create_entity(category="fish", positions=pos, orientations=ori_rad)
```
......@@ -31,7 +31,7 @@ The poses can be also passed in an combined array.
```python
# Create an entity using orientation vectors.
f.create_entity(category="fish", poses=np.ones((100,4)) * np.sqrt(2))
# Create an entity using radiant orientations
# Create an entity using radian orientations
f.create_entity(category="fish", poses=np.zeros((100,3)))
```
......@@ -39,7 +39,7 @@ f.create_entity(category="fish", poses=np.zeros((100,3)))
Multiple entities can be created at once.
```python
# Here we create 4 fishes from poses with radiant orientation
# Here we create 4 fishes from poses with radian orientation
f.create_multiple_entities(category="fish", poses=np.zeros((4,100,3)))
```
......
......@@ -20,7 +20,7 @@ def create_example_file(path):
# Create a new fish entity with 10 timesteps.
# In this case, we pass positions and orientations together (x, y, rad).
# Since it is a 3 column array, orientations in radiants are assumed.
# Since it is a 3 column array, orientations in radians are assumed.
poses = np.zeros((10, 3))
poses[:, 0] = np.arange(-5, 5)
poses[:, 1] = np.arange(-5, 5)
......
......@@ -50,7 +50,7 @@ setup(
author="",
author_email="",
install_requires=[
"h5py>=3.1.0",
"h5py>=2.10.0",
"numpy",
"seaborn",
"pandas",
......
......@@ -66,7 +66,7 @@ class Entity(h5py.Group):
def convert_rad_to_vector(cla, orientations_rad):
if min(orientations_rad) < 0 or max(orientations_rad) > 2 * np.pi:
logging.warning(
"Converting orientations, from a bigger range than [0, 2 * pi]. When passing the orientations, they are assumed to be in radiants."
"Converting orientations, from a bigger range than [0, 2 * pi]. When passing the orientations, they are assumed to be in radians."
)
ori_rad = utils.np_array(orientations_rad)
assert ori_rad.shape[1] == 1
......
......@@ -627,6 +627,7 @@ class File(h5py.File):
"view_size": 50,
"margin": 15,
"slow_view": 0.8,
"slow_zoom": 0.95,
}
options = {
......@@ -699,15 +700,15 @@ class File(h5py.File):
) * np.mean(this_pose, axis=0)
# Find the maximal distance between the entities in x or y direction
self.min_view = np.max(
min_view = np.max(
(np.max(this_pose, axis=0) - np.min(this_pose, axis=0))[:2]
)
new_view_size = np.max(
[options["view_size"], min_view + options["margin"]]
)
self.view_size = (
options["slow_view"] * self.view_size
+ (1 - options["slow_view"]) * new_view_size
options["slow_zoom"] * self.view_size
+ (1 - options["slow_zoom"]) * new_view_size
)
ax.set_xlim(
......
......@@ -150,10 +150,10 @@ def test_actions_speeds_turns_angles():
def test_entity_poses_rad(caplog):
with robofish.io.File(world_size_cm=[100, 100], frequency_hz=25) as f:
# Create an entity, using radiants
# Create an entity, using radians
f.create_entity("fish", poses=np.ones((100, 3)))
# Read the poses of the file as radiants
# Read the poses of the file as radians
np.testing.assert_almost_equal(f.entity_poses_rad, np.ones((1, 100, 3)))
caplog.set_level(logging.WARNING)
......@@ -164,7 +164,7 @@ def test_entity_poses_rad(caplog):
def test_entity_positions_no_orientation():
with robofish.io.File(world_size_cm=[100, 100], frequency_hz=25) as f:
# Create an entity, using radiants
# Create an entity, using radians
f.create_entity("fish", positions=np.ones((100, 2)))
# In poses, the default orientation pointing up should be added.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment