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
Admin message
Looking for advice? Join the
Matrix channel for GitLab users in Bielefeld
!
Show more breadcrumbs
Olivier Bertrand
navipy
Commits
16425385
Commit
16425385
authored
6 years ago
by
Olivier Bertrand
Browse files
Options
Downloads
Patches
Plain Diff
Correct typo in database loading of old version
parent
2a84c3fa
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
navipy/database/__init__.py
+1
-1
1 addition, 1 deletion
navipy/database/__init__.py
samples/asv_homing_grid.py
+21
-20
21 additions, 20 deletions
samples/asv_homing_grid.py
with
22 additions
and
21 deletions
navipy/database/__init__.py
+
1
−
1
View file @
16425385
...
...
@@ -513,7 +513,7 @@ class DataBaseLoad(DataBase):
warnings
.
warn
(
"
you are loading a database with old
\
conventions, it will be transformed
\
automatically into the new one
"
)
posorients
=
Trajectory
(
rotconv
,
indeces
=
posorient
.
index
)
posorients
=
Trajectory
()
posorients
.
from_dataframe
(
posorient
,
rotconv
=
'
rxyz
'
)
return
posorients
...
...
This diff is collapsed.
Click to expand it.
samples/asv_homing_grid.py
+
21
−
20
View file @
16425385
...
...
@@ -11,43 +11,44 @@ from navipy import Brain
# 0) Define a class heriting from Brain
class
ASVBrain
(
Brain
):
def
__init__
(
self
,
renderer
=
None
,
channel
=
0
):
Brain
.
__init__
(
self
,
renderer
=
renderer
)
Brain
.
__init__
(
self
,
renderer
=
renderer
)
# Init memory
locid
=
mydb
.
posorients
[(
mydb
.
posorients
.
x
==
0
)
&
(
mydb
.
posorients
.
y
==
0
)].
index
[
0
]
locid
=
mydb
.
posorients
[(
mydb
.
posorients
.
x
==
0
)
&
(
mydb
.
posorients
.
y
==
0
)].
index
[
0
]
posorient
=
mydb
.
posorients
.
loc
[
locid
,
:]
self
.
update
(
posorient
)
self
.
channel
=
channel
self
.
memory
=
self
.
asv
()
def
asv
(
self
):
if
self
.
channel
>
3
:
if
self
.
channel
>
3
:
return
apcv
(
1
/
self
.
vision
.
scene
,
self
.
vision
.
viewing_directions
)[...,
3
,:]
self
.
vision
.
viewing_directions
)[...,
3
,
:]
else
:
return
apcv
(
self
.
vision
.
scene
,
self
.
vision
.
viewing_directions
)[...,
self
.
channel
,:]
self
.
vision
.
viewing_directions
)[...,
self
.
channel
,
:]
def
velocity
(
self
):
homing_vector
=
self
.
memory
-
self
.
asv
()
homing_vector
=
np
.
squeeze
(
homing_vector
)
velocity
=
pd
.
Series
(
data
=
0
,
index
=
[
'
dx
'
,
'
dy
'
,
'
dz
'
,
'
dalpha_0
'
,
'
dalpha_1
'
,
'
dalpha_2
'
])
index
=
[
'
dx
'
,
'
dy
'
,
'
dz
'
,
'
dalpha_0
'
,
'
dalpha_1
'
,
'
dalpha_2
'
])
velocity
[[
'
dx
'
,
'
dy
'
,
'
dz
'
]]
=
homing_vector
return
velocity
# 1) Connect to the database
mydb_filename
=
'
/home/bolirev/database.db
'
mydb
=
DataBaseLoad
(
mydb_filename
)
for
channel
in
range
(
5
):
for
channel
in
range
(
5
):
mybrain
=
ASVBrain
(
renderer
=
mydb
,
channel
=
channel
)
# Create a grid agent
my_agent
=
GridAgent
(
mybrain
)
# init position
rowid
=
mydb
.
posorients
[(
mydb
.
posorients
.
x
==-
5
)
&
(
mydb
.
posorients
.
y
==-
5
)].
index
[
0
]
rowid
=
mydb
.
posorients
[(
mydb
.
posorients
.
x
==
-
5
)
&
(
mydb
.
posorients
.
y
==
-
5
)].
index
[
0
]
initpos
=
mybrain
.
posorients
.
loc
[
rowid
]
my_agent
.
posorient
=
initpos
...
...
@@ -64,13 +65,13 @@ for channel in range(5):
f
,
axarr
=
plt
.
subplots
(
1
,
1
,
figsize
=
(
10
,
10
))
axarr
.
plot
(
trajectory
.
x
,
trajectory
.
y
)
gridtoplot
=
mydb
.
posorients
[(
mydb
.
posorients
.
x
>
-
1
)
&
(
mydb
.
posorients
.
y
>
-
1
)
&
(
mydb
.
posorients
.
x
<
1
)
&
(
mydb
.
posorients
.
y
<
1
)]
axarr
.
plot
([
0
],[
0
],
'
ro
'
)
axarr
.
plot
(
gridtoplot
.
x
,
gridtoplot
.
y
,
'
.
'
,
color
=
'
gray
'
)
axarr
.
set_xlim
([
-
10
,
10
])
axarr
.
set_ylim
([
-
10
,
10
])
gridtoplot
=
mydb
.
posorients
[(
mydb
.
posorients
.
x
>
-
1
)
&
(
mydb
.
posorients
.
y
>
-
1
)
&
(
mydb
.
posorients
.
x
<
1
)
&
(
mydb
.
posorients
.
y
<
1
)]
axarr
.
plot
([
0
],
[
0
],
'
ro
'
)
axarr
.
plot
(
gridtoplot
.
x
,
gridtoplot
.
y
,
'
.
'
,
color
=
'
gray
'
)
axarr
.
set_xlim
([
-
10
,
10
])
axarr
.
set_ylim
([
-
10
,
10
])
f
.
show
()
f
.
savefig
(
'
plots/asv_homing_grid_channel_{}.svg
'
.
format
(
channel
))
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