RatInABox-Lab / RatInABox

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

Error if initializing GridCells with random_gridscales=False #8

Closed PikaPei closed 1 year ago

PikaPei commented 1 year ago
env = Environment()
ag = Agent(env)
grid_cells = GridCells(
        ag,
        params={"random_gridscales": False}
    )

grid_cells.plot_rate_map()

The code above raised an error:

  File "/Users/pei/.pyenv/versions/3.10.5/lib/python3.10/site-packages/ratinabox/Neurons.py", line 244, in plot_rate_map
    t_end = t_end or t[-1]
IndexError: index -1 is out of bounds for axis 0 with size 0

My quick workaround is:

self.gridscales = np.full(self.n, fill_value=self.gridscales)
TomGeorge1234 commented 1 year ago

This issue was fixed in a PR which will soon be merged once a small change is made. then I will close it

TomGeorge1234 commented 1 year ago

fixed