Skip to content

Commit ba08249

Browse files
committed
gridcell deprecation warning
1 parent 3416d93 commit ba08249

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

ratinabox/Neurons.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,8 @@ class GridCells(Neurons):
858858
859859
GridCells defines a set of 'n' grid cells with random orientations, grid scales and offsets (these can be set non-randomly of course). Grids are modelled as the rectified sum of three cosine waves at 60 degrees to each other.
860860
861+
To initialise grid cells you specify three things: (i) params['gridscale'], (ii) params['orientation'] and (iii) params['phase_offset']. These are all sampled from a distribution (specified as, e.g. params['phase_offset_distribution']) and then used to calculate the firing rate of each grid cell. For each of these there quantities the value you specify parameterises the distribution from which it is sampled. For example params['gridscale':0.45,'gridscale_distribution':'uniform'] will pull gridscales from a uniform distribution between 0 and 0.45m. The 'delta' distribution means a constant will be taken. For all three of these you can optionally just pass an array of length GridCells.n (in which case the corresponding distribution parameter is ignored). This array is set a the value for each grid cell.
862+
861863
List of functions:
862864
• get_state()
863865
• set_phase_offsets()
@@ -879,7 +881,7 @@ class GridCells(Neurons):
879881

880882
default_params = {
881883
"n": 10,
882-
"gridscale": 0.45,
884+
"gridscale": 0.50,
883885
"gridscale_distribution": "rayleigh",
884886
"orientation": None,
885887
"orientation_distribution": "uniform",
@@ -901,7 +903,10 @@ def __init__(self, Agent, params={}):
901903
self.params = copy.deepcopy(__class__.default_params)
902904
self.params.update(params)
903905

904-
906+
# deprecation warnings
907+
if ("random_gridscales" in self.params) or ("random_orientations" in self.params) or ("random_phase_offsets" in self.params):
908+
warnings.warn("the GridCell API has changed slightly, 'random_gridscales', 'random_orientations' and 'random_phase_offsets' are no longer accepted as parameters. Please use 'gridscale','gridscale_distribution','orientation','orientation_distribution','phase_offset' and 'phase_offset_distribution' instead. See docstring or 1.7.0 release notes for instructions.")
909+
905910
# Initialise the gridscales
906911
if hasattr(self.params["gridscale"],"__len__"):
907912
self.gridscales = np.array(self.params["gridscale"])

0 commit comments

Comments
 (0)