RatInABox-Lab/RatInABox

FieldOfView Neurons Unexpected Behaviour

marcoabrate opened this issue · 2 comments

Hi Tom,

I am opening an issue to better explain my problem and track progress more easily.

I am experiencing unexpected behaviour in regards to FieldOfView neurons as I anticipated last week. I ran an experiment which can probably explain my problem more clearly. I think your input would be very valuable because you have a better understanding how BVCs are coded, I can't wrap my head around it.

I have simulated a horizontal trajectory for 60 seconds, with 60 FPS. The trajectory goes from position (0.1, 0.1) to (1.1, 0.1) in a 1.2x1.2 environment.

whiskers_params = {
    "FoV_distance": [0, 0.4]
    "FoV_angles": [0, 100]
    "spatial_resolution": 0.1
}

env = Environment(params={'scale':1.2, 'aspect':1})
agent = Agent(env)
whiskers = FieldOfViewNeurons(agent, params=whiskers_params)

agent.import_trajectory(
    times=np.linspace(0, 60, 60*60),
    positions=list(zip(np.linspace(0.1, 1, 60*60), np.linspace(0.1, 0.1, 60*60))),
)

DT = 1./60
t_max = 60

for i in range(int(t_max/DT)):
    agent.update(dt=DT)
    whiskers.update()

tmp

These are the receptive fields of the BVCs associated to the FoVs (whiskers.super.plot_BVC_receptive_field())
tmp1

I would expect FoV cells index 7, 8, 16, and 17 - which are the four external cells pointing around 0 degrees (which in this case is in the right direction), see BVC plot above, they are ordered - to start firing when the agent gets close to the right wall, and keep firing until the end of the simulation.

On the other hand, these four cells fire when the agent is close to the right wall, but stop firing when the agent is TOO close to the right wall, i.e. at the end of the simulation. See the following plot (x axis: time, y axis: firing rate)
tmp2

I think the problem arises from the BVC cells. It would be great if you have a hint on how to investigate more!

Thank you!

Hi Marco,

This is expected behaviour. All cells have four key parameters:

  • tuning_angles : preferred angle to a wall (ego coordinates) at which it will fire.
  • sigma_angles : the width of the gaussian (strictly von mises) preference function for this angular preference.
  • tuning_distances : preferred distance to a wall at which it will fire.
  • sigma_distnaces : the width of the gaussian preference function for this distance preference.

So cell 7, for example, has a prefered distance of 21 cm from a wall and an std of 5 cm. This means it likes to fire roughly between 16cm and 26 cm from the wall.

print(whiskers.super.tuning_distances[7])
print(whiskers.super.sigma_distances[7])
# 0.21
# 0.05

So it should turn off as it gets too close because now the walls isn't within its receptive field. This animation might clear things up a bit...

agent.animate_trajectory(additional_plot_func=whiskers.display_manifold,speed_up=5)

whiskers_marco_1451

Unfortunately the gif is cropped but the circles represent the receptive fields in the egocentric FoV and so they actually move over and past the wall, then turning off again.

Does this clear things up?

This is very clear now! Thank you, so helpful