gridcells.analysis.fields
- grid field related analysis¶
The fields
module contains routines to analyse
spiking data either from experiments involoving a rodent running in an arena or
simulations involving an animat running in a simulated arena.
Functions¶
gridnessScore (rateMap, arenaDiam, h, ...) |
Calculate gridness score of a spatial firing rate map. |
occupancy_prob_dist (arena, pos) |
Calculate a probability distribution for animal positions in an arena. |
spatialAutoCorrelation (rateMap, arenaDiam, h) |
Compute autocorrelation function of the spatial firing rate map. |
spatialRateMap (spikeTimes, positions, arena, ...) |
Compute spatial rate map for spikes of a given neuron. |
-
gridcells.analysis.fields.
gridnessScore
(rateMap, arenaDiam, h, corr_cutRmin)[source]¶ Calculate gridness score of a spatial firing rate map.
Parameters: rateMap : np.ndarray
Spatial firing rate map.
arenaDiam : float
The diameter of the arena.
h : float
Precision of the spatial firing rate map.
Returns: G : float
Gridness score.
crossCorr : np.ndarray
An array containing cross correlation values of the rotated autocorrelations, with the original autocorrelation.
angles : np.ndarray
An array of angles corresponding to the crossCorr array.
Notes
This function computes gridness score accoring to [R1]. The auto correlation of the firing rate map is rotated in 3 degree steps. The resulting gridness score is the difference between a minimum of cross correlations at 60 and 90 degrees, and a maximum of cross correlations at 30, 90 and 150 degrees.
The center of the auto correlation map (given by corr_cutRmin) is removed from the map.
References
[R1] (1, 2) Hafting, T. et al., 2005. Microstructure of a spatial map in the entorhinal cortex. Nature, 436(7052), pp.801-806.
-
gridcells.analysis.fields.
occupancy_prob_dist
(arena, pos)[source]¶ Calculate a probability distribution for animal positions in an arena.
Parameters: arena :
Arena
Arena the animal was running in.
pos :
Position2D
Positions of the animal.
Returns: dist : numpy.ndarray
Probability distribution for the positional data, given the discretisation of the arena. The first dimension is the y axis, the second dimension is the x axis. The shape of the distribution is equal to the number of items in the discretised edges of the arena.
-
gridcells.analysis.fields.
spatialAutoCorrelation
(rateMap, arenaDiam, h)[source]¶ Compute autocorrelation function of the spatial firing rate map.
This function assumes that the arena is a circle and masks all values of the autocorrelation that are outside the arenaDiam.
Warning
This function will undergo serious interface changes in the future.
Parameters: rateMap : np.ndarray
Spatial firing rate map (2D). The shape should be (arenadiam/h+1, arenadiam/2+1).
arenaDiam : float
Diameter of the arena.
h : float
Precision of the spatial firing rate map.
Returns: corr : np.ndarray
The autocorrelation function, of shape (arenadiam/h*2+1, arenaDiam/h*2+1)
xedges, yedges : np.ndarray
Values of the spatial lags for the correlation function. The same shape as corr.shape[0].
-
gridcells.analysis.fields.
spatialRateMap
(spikeTimes, positions, arena, sigma)[source]¶ Compute spatial rate map for spikes of a given neuron.
Preprocess neuron spike times into a smoothed spatial rate map, given arena parameters. Both spike times and positional data must be aligned in time! The rate map will be smoothed by a gaussian kernel.
Parameters: spikeTimes : np.ndarray
Spike times for a given neuron.
positions : gridcells.core.Position2D
Positional data for these spikes. The timing must be aligned with
spikeTimes
arena : gridcells.core.Arena
The specification of the arena in which movement was carried out.
sigma : float
Standard deviation of the Gaussian smoothing kernel.
Returns: rateMap : np.ma.MaskedArray
The 2D spatial firing rate map. The shape will be determined by the arena type.