Grid cell model with compression effects (Raudies & Hasselmo, 2015)

 Download zip file 
Help downloading and running models
Accession:194881
We present a model for compression of grid cell firing in modules to changes in barrier location.
Reference:
1 . Raudies F, Hasselmo ME (2015) Differences in Visual-Spatial Input May Underlie Different Compression Properties of Firing Fields for Grid Cell Modules in Medial Entorhinal Cortex. PLoS Comput Biol 11:e1004596 [PubMed]
Citations  Citation Browser
Model Information (Click on a link to find other models with that property)
Model Type:
Brain Region(s)/Organism: Entorhinal cortex;
Cell Type(s):
Channel(s):
Gap Junctions:
Receptor(s):
Gene(s):
Transmitter(s):
Simulation Environment: MATLAB;
Model Concept(s): Grid cell;
Implementer(s): Raudies, Florian [florian.raudies at gmail.com];
/
RaudiesHasselmo2015
DotWorld
screenshots
README.html
attractorModel.m
errorarea.m
estimatePosition.m
estimateVelocity.m
Fig2.m
Fig3.m
Fig4.m
FigS1.m
FigS3.m
gpl-3.0.txt *
gridScoreForActivity.m
gridScoreForSpikes.m
ModuleModel.m
randomTrajectory.m
rescaleCorr.m
SimConfA.m
SimConfA.mat
SimConfB.m
SimConfB.mat
SimNoiseWithBias.m
SimNoiseWoutBias.m
TestEstimatePosition.m
vcoModel.m
                            
function [gs SpikeRate] = gridScoreForSpikes(SpikePosCm,TrajPosCm, opt)
% gridScoreForSpikes
%   G       - Positions of spikes with dimensions: (nSample x 2) in cm.
%   opt     - Structure with fields:
%             * NumPx - Number of pixel in horizontal and vertical
%                       direction in that order.
%             * DimCm - Dimensions of the box in horizontal and vertical
%                       direction in that order.
%               
% RETURN
%   gs      - Grid score that ranges between -2 and +2.
%
% DESCRIPTION
%   A detailed a description of this measure can be found in the
%   supplementary material of Langston, R. F., Ainge, J. A., Couey, J. J., 
%   Canto, C. B., Bjerkens, T. L., Witter, M. P., Moser, E. I., 
%   & Moser, M.-B. (2010). Development of the spatial representation 
%   system in the rat. Science, 328, 1576–1580.
%
%   Copyright (C) 2015  Florian Raudies, 05/02/2015, Palo Alto, CA.
%   License, GNU GPL, free software, without any warranty.
%

if isfield(opt, 'NumPx'),       NumPx       = opt.NumPx;
else                            NumPx       = [31 31];          end
if isfield(opt, 'DimCm'),       DimCm       = opt.DimCm;
else                            DimCm       = [-50 50 -50 50];  end

xMinCm = DimCm(1);
xMaxCm = DimCm(2);
yMinCm = DimCm(3);
yMaxCm = DimCm(4);

if 0.8*xMinCm < min(TrajPosCm(:,1)) ...
        || 0.8*xMaxCm > max(TrajPosCm(:,1)) ...
        || 0.8*yMinCm < min(TrajPosCm(:,2)) ...
        || 0.8*yMaxCm > max(TrajPosCm(:,2)),
    warning('Matlab:Parameter','Shrink the DimCm to match the data!');
end

if 1.05*xMinCm > min(TrajPosCm(:,1)) ...
        || 1.05*xMaxCm < max(TrajPosCm(:,1)) ...
        || 1.05*yMinCm > min(TrajPosCm(:,2)) ...
        || 1.05*yMaxCm < max(TrajPosCm(:,2)),
    warning('Matlab:Parameter','Increase the DimCm to match the data!');
end

% Get spike count in bins registering the positions at which spikes occured.
SpikeCount  = getOccupancyMap(SpikePosCm,DimCm,NumPx);
Occupancy   = getOccupancyMap(TrajPosCm,DimCm,NumPx);
SpikeRate   = SpikeCount./(eps+Occupancy);

% Calculate the grid score from the spike rate map.
gs = gridScoreForActivity(SpikeRate, opt);


function Occupancy = getOccupancyMap(PosCm,DimCm,NumPx)
    % getOccupancyMap
    %   PosCm       - x,y coordinates in 2nd dimension sample points in 1st
    %                 dimension in units of cm.
    %   DimCm       - Dimensions in cm for x and y. Assumes the center to be in
    %                 the middle. DimCm = [xMinCm xMinCm yMinCm yMaxCm]
    %   DimPx       - Dimension in pixels for x and y.
    %                 DimPx = [xLenPx yLenPx]
    %
    % RETURN
    %   Occupancy   - Map that encodes the occupancy of the rat in the box
    %                 according to the binning into a 2D pixel grid.

    xMinCm = DimCm(1);
    xMaxCm = DimCm(2);
    yMinCm = DimCm(3);
    yMaxCm = DimCm(4);

    xLenCm = xMaxCm - xMinCm;
    yLenCm = yMaxCm - yMinCm;

    xCenCm = xLenCm/2;
    yCenCm = yLenCm/2;

    xLenPx = NumPx(1);
    yLenPx = NumPx(2);

    PosPx = [min(max(ceil( (PosCm(:,1) + xCenCm)/xLenCm * xLenPx ),1),xLenPx) ...
             min(max(ceil( (PosCm(:,2) + yCenCm)/yLenCm * yLenPx ),1),yLenPx)];

    LinearIndex = sub2ind([yLenPx xLenPx], PosPx(:,2), PosPx(:,1));
    Occupancy   = zeros(yLenPx, xLenPx);
    nPos        = numel(LinearIndex);
    for iPos = 1:nPos,
       Occupancy(LinearIndex(iPos)) = Occupancy(LinearIndex(iPos))+1; 
    end