RatInABox-Lab/RatInABox

Modules of grid cells with uniform offsets

TomGeorge1234 opened this issue · 1 comments

A user asked: "If I want to generate 10*4 grid cells with uniform phase offset, 10 cells in each module and 4 modules in total. What is the best way to do that?"

There are three params you care about here: "gridscale", "orientation" and "phase_offset". If these are passed as tuples RatInABox assumes they are specifying the parameters of a distribution you wish to sample from (specified by the "_distribution" param, see doc string for more info). If they are passed as array-like objects it assumes you want to set them manually from this array (in which case the length of the array should of course match "n").

So in your case I would use the "modules" distribution for gridscale (the tuple then gives a list of module gridscales in meters) and set the other two manually (I don't know exactly what you want here but the below makes each module slightly rotated from the last and cells in each module uniformly move from [0,0] to [2pi, 2pi] phase offset but im sure you can generalise).

Env = Environment()
Ag = Agent(Env)
GCs = GridCells(Ag, params={
     "n":40,
     "gridscale":(0.1,0.3,0.6,1.0),
     "gridscale_distribution": "modules", #the 40 cells are split evenly between the four modules
     "orientation":([0]*10 + [0.1]*10 + [0.2]*10 + [0.3]*10),
     "phase_offset":[(1/10)*(i%10)*np.array([2*np.pi, 2*np.pi]) for i in range(40)]
})

GCs.plot_rate_map(shape=(4,10))

81a1881e-a250-455d-89f4-74a2aec89913

Make sense?

Great! Makes lots of sense! Many thanks!