Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
navipy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Olivier Bertrand
navipy
Commits
1dd05b6b
Commit
1dd05b6b
authored
6 years ago
by
Olivier Bertrand
Browse files
Options
Downloads
Patches
Plain Diff
Add compute from partial velocity
parent
ec54e78b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
navipy/moving/agent.py
+14
-15
14 additions, 15 deletions
navipy/moving/agent.py
with
14 additions
and
15 deletions
navipy/moving/agent.py
+
14
−
15
View file @
1dd05b6b
...
@@ -366,6 +366,15 @@ the agent motion, or
...
@@ -366,6 +366,15 @@ the agent motion, or
self
.
_graph
.
add_node
(
row_id
,
self
.
_graph
.
add_node
(
row_id
,
posorient
=
posor
)
posorient
=
posor
)
self
.
mode_of_motion
=
mode_of_motion
self
.
mode_of_motion
=
mode_of_motion
# Create a dataframe to store the velocities
convention
=
self
.
_brain
.
renderer
.
rotation_convention
tuples_posvel
=
posorient_columns
(
convention
)
tuples_posvel
.
extend
(
velocities_columns
(
convention
))
index_posvel
=
pd
.
MultiIndex
.
from_tuples
(
tuples_posvel
,
names
=
[
'
position
'
,
'
orientation
'
])
self
.
velocities
=
pd
.
DataFrame
(
columns
=
index_posvel
,
index
=
list
(
self
.
_graph
.
nodes
()))
@property
@property
def
graph
(
self
):
def
graph
(
self
):
...
@@ -383,26 +392,16 @@ the agent motion, or
...
@@ -383,26 +392,16 @@ the agent motion, or
timeout
=
1
,
timeout
=
1
,
filename
=
None
,
filename
=
None
,
blocksize
=
100
):
blocksize
=
100
):
# Create a dataframe to store the velocities
nodes_tocompute
=
self
.
velocities
.
isna
().
any
(
axis
=
1
)
convention
=
self
.
_brain
.
renderer
.
rotation_convention
nodes_tocompute
=
nodes_tocompute
[
nodes_tocompute
].
index
tuples_posvel
=
posorient_columns
(
convention
)
tuples_posvel
.
extend
(
velocities_columns
(
convention
))
index_posvel
=
pd
.
MultiIndex
.
from_tuples
(
tuples_posvel
,
names
=
[
'
position
'
,
'
orientation
'
])
self
.
velocities
=
pd
.
DataFrame
(
columns
=
index_posvel
,
index
=
list
(
self
.
_graph
.
nodes
()))
# Build a list of nodes
# Build a list of nodes
posorients_queue
=
JoinableQueue
()
posorients_queue
=
JoinableQueue
()
results_queue
=
Queue
()
results_queue
=
Queue
()
if
version
<
2
:
for
node
in
nodes_tocompute
:
graph_nodes
=
list
(
self
.
_graph
.
nodes
())
else
:
graph_nodes
=
list
(
self
.
_graph
.
nodes
)
for
node
in
graph_nodes
:
posorients_queue
.
put
(
self
.
_graph
.
nodes
[
node
][
'
posorient
'
])
posorients_queue
.
put
(
self
.
_graph
.
nodes
[
node
][
'
posorient
'
])
# Start ndatabase loader
# Start ndatabase loader
convention
=
self
.
_brain
.
renderer
.
rotation_convention
num_agents
=
ncpu
num_agents
=
ncpu
agents
=
[
CyberBeeAgent
(
copy
.
copy
(
self
.
_brain
),
agents
=
[
CyberBeeAgent
(
copy
.
copy
(
self
.
_brain
),
convention
=
convention
,
convention
=
convention
,
...
@@ -421,7 +420,7 @@ the agent motion, or
...
@@ -421,7 +420,7 @@ the agent motion, or
nline
=
0
nline
=
0
prev_nline
=
nline
prev_nline
=
nline
t_start
=
time
.
time
()
t_start
=
time
.
time
()
nbnodes
=
n
x
.
number_of_nodes
(
self
.
_graph
)
nbnodes
=
n
odes_tocompute
.
shape
[
0
]
for
_
in
range
(
nbnodes
):
for
_
in
range
(
nbnodes
):
res
=
results_queue
.
get
(
timeout
=
timeout
)
res
=
results_queue
.
get
(
timeout
=
timeout
)
self
.
velocities
.
loc
[
res
.
name
,
res
.
index
]
=
res
self
.
velocities
.
loc
[
res
.
name
,
res
.
index
]
=
res
...
...
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