Skip to content
Snippets Groups Projects
Commit d55ee4c3 authored by Olivier Bertrand's avatar Olivier Bertrand
Browse files

Add Annes Lobecke sample experiment for didactiv purposes

parent 16425385
No related branches found
No related tags found
No related merge requests found
from navipy import Brain from navipy import Brain
from navipy.processing.pcode import apcv from navipy.processing.pcode import apcv, skyline
import pandas as pd import pandas as pd
import numpy as np
# 0) Define a class heriting from Brain # 0) Define a class heriting from Brain
def processing(scene, viewing_directions, channel):
""" Return the average skyline vector by doing
* inverse of distance (i.e. distance -> nearness)
* summing along elevation (i.e. estimate of skyline)
* vector summing of skyline vector
Average place cell vector on the skyline
refer as skyline vector:
* Müller et al. 2018
* Basten and Mallot 2010
refer as COMANV in :
* Hafter 2000,
* Bertrand 2015
center of mass of average nearness vector
"""
# Invert distance to nearness
scene[..., 3, :] = 1/scene[..., 3, :]
# Calculate the skyline
scene = skyline(scene)
comanv = apcv(scene, viewing_directions)
return comanv[..., channel, :]
def comparing(current, memory):
""" Calculate homing vector
homing vector = current vector - memory vector
"""
class ASVBrain(Brain): class ASVBrain(Brain):
def __init__(self, def __init__(self,
memory, memory,
...@@ -15,19 +46,13 @@ class ASVBrain(Brain): ...@@ -15,19 +46,13 @@ class ASVBrain(Brain):
self.channel = channel self.channel = channel
self.memory = memory self.memory = memory
def asv(self):
if self.channel > 3:
return apcv(1/self.vision.scene,
self.vision.viewing_directions)[..., 3, :]
else:
return apcv(self.vision.scene,
self.vision.viewing_directions)[..., self.channel, :]
def velocity(self): def velocity(self):
index = self.posorient.index index = self.posorient.index
convention = index.levels[0][-1] convention = index.levels[0][-1]
homing_vector = self.memory - self.asv() current = processing(self.vision.scene,
homing_vector = np.squeeze(homing_vector) self.vision.viewing_directions,
self.channel)
homing_vector = comparing(current, self.memory)
indeces = [('location', 'dx'), ('location', 'dy'), indeces = [('location', 'dx'), ('location', 'dy'),
('location', 'dz'), (convention, 'dalpha_0'), ('location', 'dz'), (convention, 'dalpha_0'),
(convention, 'dalpha_1'), (convention, 'dalpha_2')] (convention, 'dalpha_1'), (convention, 'dalpha_2')]
......
This diff is collapsed.
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment