Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
io
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bioroboticslab
robofish
io
Commits
dddae355
Commit
dddae355
authored
Nov 11, 2022
by
Andi Gerken
Browse files
Options
Downloads
Patches
Plain Diff
Fixed deprecation warning
Removed buggy quiver from standard evaluation.
parent
cb9656dc
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!41
Fixed deprecation warning
Pipeline
#52899
passed
Nov 11, 2022
Stage: package
Stage: test
Stage: deploy
Stage: trigger
Changes
3
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/robofish/evaluate/app.py
+6
-5
6 additions, 5 deletions
src/robofish/evaluate/app.py
src/robofish/evaluate/evaluate.py
+7
-3
7 additions, 3 deletions
src/robofish/evaluate/evaluate.py
src/robofish/io/file.py
+7
-9
7 additions, 9 deletions
src/robofish/io/file.py
with
20 additions
and
17 deletions
src/robofish/evaluate/app.py
+
6
−
5
View file @
dddae355
...
...
@@ -36,20 +36,21 @@ def function_dict() -> dict:
"
follow_iid
"
:
base
.
evaluate_follow_iid
,
"
individual_speed
"
:
base
.
evaluate_individual_speed
,
"
individual_iid
"
:
base
.
evaluate_individual_iid
,
"
quiver
"
:
base
.
evaluate_quiver
,
#
"quiver": base.evaluate_quiver,
# Quiver has issues with multiple paths and raises exceptions. The function is not used for now.
"
all
"
:
base
.
evaluate_all
,
}
def
evaluate
(
args
=
None
)
:
def
evaluate
(
args
:
dict
=
None
)
->
None
:
"""
This function can be called from the commandline to evaluate files.
The function is called with robofish-io-evaluate. Different evaluation
methods can be called, which generate graphs from the given files
Args:
args: a dictionary to overwrite the argument parser
(robofish-io-evaluate --help for more info)
args (dict, optional): a dictionary to overwrite the argument parser (robofish-io-evaluate --help for more info)
Raises:
ValueError: When the analysis type is all, and no save_path is given.
"""
fdict
=
function_dict
()
...
...
@@ -104,7 +105,7 @@ def evaluate(args=None):
args
=
parser
.
parse_args
()
if
args
.
analysis_type
==
"
all
"
and
args
.
save_path
is
None
:
raise
Exception
(
"
When the analysis type is all, a --save_path must be given.
"
)
raise
ValueError
(
"
When the analysis type is all, a --save_path must be given.
"
)
if
args
.
analysis_type
in
fdict
:
if
args
.
labels
is
None
:
...
...
This diff is collapsed.
Click to expand it.
src/robofish/evaluate/evaluate.py
+
7
−
3
View file @
dddae355
...
...
@@ -515,13 +515,17 @@ def evaluate_quiver(
# )
# print(speeds_turns_from_paths)
try
:
speeds_turns_from_paths
=
np
.
array
(
speeds_turns_from_paths
)
print
(
speeds_turns_from_paths
)
speeds_turns_from_paths
=
np
.
stack
(
[
np
.
array
(
st
,
dtype
=
np
.
float32
)
for
st
in
speeds_turns_from_paths
]
)
except
Exception
as
e
:
warnings
.
warn
(
f
"
The conversion to numpy array failed:
\n
speeds_turns_from_path
.shape
was
{
speeds_turns_from_paths
.
shape
}
. Exception was
{
e
}
"
f
"
The conversion to numpy array failed:
\n
len(
speeds_turns_from_path
)
was
{
len
(
speeds_turns_from_paths
)
}
. Exception was
{
e
}
"
)
return
print
(
speeds_turns_from_paths
.
dtype
)
print
(
speeds_turns_from_paths
)
all_poses
=
torch
.
tensor
(
poses_from_paths
)[
0
,
:,
:,
:
-
1
].
reshape
((
-
1
,
4
))
speed
=
torch
.
tensor
(
speeds_turns_from_paths
)[
0
,
...,
0
].
flatten
()
all_poses_speed
=
torch
.
clone
(
all_poses
)
...
...
This diff is collapsed.
Click to expand it.
src/robofish/io/file.py
+
7
−
9
View file @
dddae355
...
...
@@ -16,7 +16,6 @@
# -----------------------------------------------------------
from
__future__
import
annotations
from
pytest
import
skip
import
robofish.io
from
robofish.io.entity
import
Entity
import
h5py
...
...
@@ -36,11 +35,10 @@ import warnings
from
textwrap
import
wrap
import
platform
import
matplotlib
as
mpl
import
matplotlib
import
matplotlib.pyplot
as
plt
from
matplotlib
import
animation
from
matplotlib
import
patches
from
matplotlib
import
cm
from
tqdm.auto
import
tqdm
...
...
@@ -850,19 +848,19 @@ class File(h5py.File):
def
plot
(
self
,
ax
:
m
pl
.
axes
=
None
,
ax
:
m
atplotlib
.
axes
=
None
,
lw_distances
:
bool
=
False
,
lw
:
int
=
2
,
ms
:
int
=
32
,
figsize
:
Tuple
[
int
]
=
None
,
step_size
:
int
=
4
,
c
:
List
=
None
,
cmap
:
m
pl
.
colors
.
Colormap
=
"
Set1
"
,
cmap
:
m
atplotlib
.
colors
.
Colormap
=
"
Set1
"
,
skip_timesteps
=
0
,
max_timesteps
=
None
,
show
=
False
,
legend
=
True
,
)
->
m
pl
.
axes
:
)
->
m
atplotlib
.
axes
:
"""
Plot the file using matplotlib.pyplot
The tracks in the file are plotted using matplotlib.plot().
...
...
@@ -910,7 +908,7 @@ class File(h5py.File):
else
:
step_size
=
poses
.
shape
[
1
]
cmap
=
cm
.
get_c
map
(
cmap
)
cmap
=
matplotlib
.
color
map
s
[
cmap
]
x_world
,
y_world
=
self
.
world_size
if
figsize
is
None
:
...
...
@@ -1260,10 +1258,10 @@ class File(h5py.File):
)
current_pose
=
entity_poses
[
i_entity
,
file_frame
]
t
=
m
pl
.
transforms
.
Affine2D
().
translate
(
t
=
m
atplotlib
.
transforms
.
Affine2D
().
translate
(
current_pose
[
0
],
current_pose
[
1
]
)
r
=
m
pl
.
transforms
.
Affine2D
().
rotate
(
current_pose
[
2
])
r
=
m
atplotlib
.
transforms
.
Affine2D
().
rotate
(
current_pose
[
2
])
tra
=
r
+
t
+
ax
.
transData
entity_polygons
[
i_entity
].
set_transform
(
tra
)
else
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment