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
33228dc5
Commit
33228dc5
authored
Jun 26, 2024
by
mhocke
Browse files
Options
Downloads
Patches
Plain Diff
Render swarm center
parent
07869025
No related branches found
No related tags found
1 merge request
!50
Merge dev_mathis with multiple changes
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/robofish/io/app.py
+2
-0
2 additions, 0 deletions
src/robofish/io/app.py
src/robofish/io/file.py
+40
-2
40 additions, 2 deletions
src/robofish/io/file.py
with
42 additions
and
2 deletions
src/robofish/io/app.py
+
2
−
0
View file @
33228dc5
...
...
@@ -236,6 +236,8 @@ def render(args: argparse.Namespace = None) -> None:
"
show_ids
"
:
False
,
"
render_goals
"
:
False
,
"
render_targets
"
:
False
,
"
render_zones
"
:
False
,
"
render_swarm_center
"
:
False
,
"
highlight_switches
"
:
False
,
"
figsize
"
:
10
,
}
...
...
This diff is collapsed.
Click to expand it.
src/robofish/io/file.py
+
40
−
2
View file @
33228dc5
...
...
@@ -1060,6 +1060,8 @@ class File(h5py.File):
"
show_ids
"
:
False
,
"
render_goals
"
:
False
,
"
render_targets
"
:
False
,
"
render_zones
"
:
False
,
"
render_swarm_center
"
:
False
,
"
highlight_switches
"
:
False
,
"
dpi
"
:
200
,
"
figsize
"
:
10
,
...
...
@@ -1081,6 +1083,26 @@ class File(h5py.File):
plt
.
plot
([],
[],
lw
=
options
[
"
linewidth
"
],
zorder
=
0
)[
0
]
for
_
in
range
(
n_entities
)
]
zone_sizes
=
(
get_zone_sizes
(
self
.
attrs
.
get
(
"
guppy_model_rollout
"
,
""
))
if
options
[
"
render_zones
"
]
else
{}
)
zones
=
[
plt
.
Circle
((
0
,
0
),
zone_size
,
color
=
"
k
"
,
alpha
=
0.5
,
fill
=
False
)
for
zone_size
in
zone_sizes
.
values
()
]
if
options
[
"
render_swarm_center
"
]
and
len
([
e
for
e
in
self
.
entities
if
e
.
category
==
"
organism
"
])
>
0
:
swarm_center_position
=
np
.
stack
(
[
e
.
positions
for
e
in
self
.
entities
if
e
.
category
==
"
organism
"
]
).
mean
(
axis
=
0
)
swarm_center
=
[
plt
.
scatter
([],
[],
marker
=
"
.
"
,
color
=
"
k
"
),
]
else
:
swarm_center
=
[]
for
zone
in
zones
:
ax
.
add_artist
(
zone
)
annotations
=
[]
if
options
[
"
show_ids
"
]:
ids
=
None
...
...
@@ -1233,7 +1255,7 @@ class File(h5py.File):
for
e_poly
in
entity_polygons
:
ax
.
add_patch
(
e_poly
)
ax
.
add_patch
(
border
)
return
lines
+
entity_polygons
+
[
border
]
+
points
return
lines
+
entity_polygons
+
[
border
]
+
points
+
zones
+
swarm_center
n_frames
=
self
.
entity_poses
.
shape
[
1
]
...
...
@@ -1348,6 +1370,15 @@ class File(h5py.File):
poses_trails
=
entity_poses
[
:,
max
(
0
,
file_frame
-
options
[
"
trail
"
])
:
file_frame
]
for
zone
in
zones
:
zone
.
center
=
(
this_pose
[
0
,
0
],
this_pose
[
0
,
1
],
)
if
options
[
"
render_swarm_center
"
]:
swarm_center
[
0
].
set_offsets
(
swarm_center_position
[
file_frame
])
for
i_entity
in
range
(
n_entities
):
lines
[
i_entity
].
set_data
(
poses_trails
[
i_entity
,
:,
0
],
poses_trails
[
i_entity
,
:,
1
]
...
...
@@ -1366,7 +1397,14 @@ class File(h5py.File):
)
return
(
output_list
+
lines
+
entity_polygons
+
[
border
]
+
points
+
annotations
output_list
+
lines
+
entity_polygons
+
[
border
]
+
points
+
annotations
+
zones
+
swarm_center
)
print
(
f
"
Preparing to render n_frames:
{
n_frames
}
"
)
...
...
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