RatInABox-Lab / RatInABox

A python package for modelling locomotion in complex environments and spatially/velocity selective cell activity.
MIT License
175 stars 31 forks source link

BVC tuning distances distribution #45

Closed jquinnlee closed 1 year ago

jquinnlee commented 1 year ago

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!

TomGeorge1234 commented 1 year ago

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:

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))

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.

jquinnlee commented 1 year ago

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!

TomGeorge1234 commented 1 year ago

awesome, sounds good! thanks for the proposal