RatInABox-Lab/RatInABox

BVC tuning distances distribution

jquinnlee opened this issue · 3 comments

Hello! Just writing to suggest a small feature that I hope is useful for the BVC cell type. I have noticed the tuning distance parameter for the tuning_distances attribute in the BVC class is drawn from a Rayleigh distribution by default. Based on some recent comparisons against large population recordings, I am observing better fits in a BVC-to-Place model if the BVC tuning distances are drawn from a uniform distribution, and I thought this could be a useful feature to integrate. The solution I have found easy enough is to add the param "max_wall_dist" to the params dictionary and perhaps a string to determine whether the distances are drawn from a uniform or rayleigh distribution, and then define the tuning distances from a uniform distribution, e.g:

default_params = {
"n": 10,
"reference_frame": "allocentric",
"pref_wall_dist": 0.15,
"max_wall_dist": 0.75,
"distance_distribution": "uniform",
"angle_spread_degrees": 11.25,
"xi": 0.08,
"beta": 12,
"dtheta": 2,
"min_fr": 0,
"max_fr": 1,
"name": "BoundaryVectorCells",
}

...

if distance_distribution == "uniform":
self.tuning_distances = np.random.uniform(low=0, high=self.max_wall_dist, size=self.n)
else:
self.tuning_distances = np.random.rayleigh(scale=self.pref_wall_dist, size=self.n)

Perhaps this would be a useful option to integrate for the BVC class. Many thanks for the amazing tool box!

Hey Quinn, good to hear from you! And thanks, I didn't know this about BVC tuning distances, it's always nice to have some more biological realism. Would you be interested in becoming a contributor, making these changes yourself and pull requesting them in. If so, here are some suggested changes I'd make:

  • Maybe consider changing "distance_distribution" to "pref_wall_distance_distribution" (wordy but more readable).
  • A small issue I have is that the additional parameter "max_wall_dist" only applies to the case where params["distance_distribution"] == "uniform" and is redundant otherwise. It would be better to double up on the already existing pref_wall_distance. So in full:
if pref_wall_distance_distribution == 'rayleigh':  
   self.tuning_distances = np.random.rayleigh(scale=self.pref_wall_distance, size=self.n)
if pref_wall_distance_distribution == 'normal':  
   self.tuning_distances = normal(low=0, high=2*self.pref_wall_distance, size=self.n)
# may as well add this one in while we're here...
if pref_wall_distance_distribution == 'delta':   
   self.tuning_distances = self.pref_wall_distance * np.ones(size=(self.n))
  • Update the BVC docstring just to describe to everyone how it works.

Thoughts? No worries I can defo do it myself but may not get round to it for a couple of weeks due to other deadlines.

Hey Tom, Yes I'd be more than happy to contribute, and this seems like a perfect place to start. I can make these changes later today and do a pull request!

awesome, sounds good! thanks for the proposal