RatInABox-Lab / RatInABox

A python package for simulating 2D motion in continuous environment and spatial cell types (e.g. place cell).
MIT License
184 stars 31 forks source link

Flexible Manifolds in FOV Cells #71

Closed mehulrastogi closed 1 year ago

mehulrastogi commented 1 year ago

Right now, the manifolds in the FOV Cells are kind of uniform, which might not be the case for rats in general.

Having a separate get_manifolds function to return the 4 lists that control the manifolds of the FOVCells might go a long way. This, in theory, can be overwritten by any user to define any custom manifolds they want.

Proposing two default support for the manifold

This will require the following:-

TomGeorge1234 commented 1 year ago

Ok in the light of day I can think about this more clearly. I think we need to not over complicate this, so for example I think it's too much to pass in the get_manifold_function as an argument. Almost all users won't use this. I suggest the following:

Four arguments are passed:

Then, a class method, called get_manifold(FoV_distances, FoV_angles, spatial_resolution, manifold_function) returns the four lists tuning_distance, tuning_angles, sigma_distances, sigma_angles.

*side note: the spatial_resolution parameter has a clear meaning for the "uniform" manifold type; as before its just the size of each cells receptive field, and all cells are the same size. In the other (now default) case where manifold_function == "hartley" I propose this resolution sets the size of the smallest cells, i.e. those on the circle arc nearest to the Agent, then they get larger the further out you get. Seem fair?

**If people really want more complex manifold I'd allow that the parameter "manifold_function" instead of being a string can be a function passed by the user. Iff its a function will it get called instead of the standard class method. This function should probably take no arguments and return the four lists, its then on the users to define it up so it's correctly parameterised for their case.

Let me know if this seems appropriate to you @mehulrastogi

mehulrastogi commented 1 year ago

Yes this is exactly what I was talking about :) . Also I like the idea of allowing users to pass in the "manifold_function"

TomGeorge1234 commented 1 year ago

This is now done, see the edits to contribs/FieldOfViewNeurons.py in the fov_manifolds branch.

Another point (this now overlaps with #56 which I'll close and we'll carry on this discussion here) is that actually the restructuring of OVCs and BVCs might go further than what we discussed, specifically I could imagine that:

Neurons
└── VectorCells(Neurons)
    ├──BoundaryVectorCells(VectorCells)
        └──FoVBoundaryVectorCells(BoundaryVectorCells)
    └── ObjectVectorCells(VectorCells)
        └──FoVObjectVectorCells(ObjectVectorCells)

Feel free to iterate if you think this is not the most OOP ideal way? But I dont think FieldOfViewNeurons needs to be a distinct class. They're just special types of BVCs or OVCs where all the distance and angular tunings are arranged in a unique way (i.e on a manifold).Thats all. By the way I think we should try stop using the term "manifold". It's my fault, but it's a really loaded term in neuroscience and we're definitely using it wrong here. I suggest all VectorCells have a dictionary instead called vector_cell_params which contains the tuning_distances, tuning_angles, sigma_distances etc. In the case of FoV neurons these happen to be neatly arranged on a manifold but in general its not necessary.

display_manifold() (or lets call it display_vector_cells) should be a method of VectorNeurons (except maybe a version of it in OVCs which determines which of the object type manifolds to plot) and it should check if the VectorCells are egocentric or allocentric and plot accordingly. It uses the vector_cell_params dict to know what and where to plot.

TomGeorge1234 commented 1 year ago

at long last, closed with pr #77. Thanks @mehulrastogi super work!