Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/nielsenlabmbi/PSSModelMLE
17 March 2021, 23:59:00 UTC
  • Code
  • Branches (1)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/main
    • 7a4bba49cd2c72fab0623f3c3756fd55506cc816
    No releases to show
  • 1791932
  • /
  • modelFunctionNielsenLempel2021.m
Raw File Download Save again
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge
swh:1:cnt:ec281cb6fe19015768311118e8afba03f1e63cf8
origin badgedirectory badge
swh:1:dir:17919326f26199893f06092e835b68deaf7673ea
origin badgerevision badge
swh:1:rev:7a4bba49cd2c72fab0623f3c3756fd55506cc816
origin badgesnapshot badge
swh:1:snp:c636966b773a5bc3bd880ad4ff5ec5a503b9d76c

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
Tip revision: 7a4bba49cd2c72fab0623f3c3756fd55506cc816 authored by nielsenlabmbi on 31 December 2020, 11:04:24 UTC
Create LICENSE
Tip revision: 7a4bba4
modelFunctionNielsenLempel2021.m
function [Prob linModel dOri MotionDir] = modelFunctionNielsenLempel2021(Params,Data,V1Resp)
% Returns the -log(likelihood) of empirical data given by Data from a model
% implementation with V1 responses given by V1Resp and parameters given by
% Params. 

% Input variables:

% Params is a vector containing the values for paramters: [I Ke Ki Tpss MxResp]
% Data is a structure containing the following field: 
% BResp: the baseline firing rate of the neuron calculated as the 
% spikes/second fiered during presentation of blank stimulus.
% Data: Vector containing the total number of spikes fired by the neuron
% across all presentations for each stimuli. Data stored in psition X of this vector
% must correspond to spikes elicited by a stimulus of dOri and motion
% direction given in the X position of the output variables dOri and
% MotionDir respectively.
% Reps: Vector containing the number of times that a each stimulus
% condition was presented to the animal. Same stimuli order as Data field.
% V1Resp: V1 responses to be used for the model. For this input variable
% responses must be organized in a 2D matrix where where V1Resp(x,y)
% corresponds to the response of the model V1 neuron to a stimuli composed
% of 2 gratings with motion directions 22.5*x and 22.5*y deg. Positions along
% the diagonal indicate responses to gratings of direction 22.5*x deg. 

% Output variables:

% Prob: sum of -log(likelihood) of empirical data given by Data assuming a
% poisson distribution of spikes for each condition with event frequency
% equal to the response of the model PSS neurons.
% linmodel: responses for the modeled PSS neuron for all stimuli
% conditions. Same stimuli order as Data.Data.


Inh=Params(1);
Width=Params(2);
WidthI=Params(3);
MtNL=Params(4);
MXResp=Params(5);


V1Resp=V1Resp./max(V1Resp(:));

%Compute V1 population responses

for N = 1:16
    popV1Resp(:,:,N) = circshift(V1Resp,[N-1 N-1]);
end

% Set MT Weights

MTE = circ_vmpdf([0:1:15]*(2*pi/16),14*pi/16,2^Width);
MTE = MTE./max(MTE);

MTI = circshift(circ_vmpdf([0:1:15]*(2*pi/16),14*pi/16,2^WidthI),8);
MTI = MTI./max(MTI);

MTW = MTE - MTI*Inh;

% Get MT Resp

MtModel = zeros(16,16);
 
for i = 1:16
    MtModel = MtModel + popV1Resp(:,:,i).*MTW(i);
end

if max(MtModel(:))>0
MtModel=MtModel./(max(MtModel(:)));
else
MtModel = zeros(16,16);    
end
MtModel(MtModel<0)=0;
MtModel = MtModel.^MtNL;
% MtModel = MtModel - MtNL;

if max(MtModel(:))>0
MtModel=MtModel./(max(MtModel(:)));
else
MtModel = zeros(16,16);    
end

% Allign to pref ori

for ori = 1:16
TCunit(ori) = MtModel(ori,ori);
end

mx = find(TCunit == max(TCunit));

MtModel = MtModel([mx:end 1:mx-1],[mx:end 1:mx-1]);
linModel=[];
for i = 1:16
    linModel=[linModel MtModel(i,1:end-(i-1))];
end
linModel([9 25 40 54 67 79 90 100])=[];

linModel=linModel*MXResp;
linModel=linModel+Data.BResp;
% Implement minimum baseline response frequency to prevent expected
% response form being 0 which would result in log(likelihood) = -inf.
linModel(linModel<.01)=.01;

% For every empirical response calculate the probability of encoutered
% events (spikes) given a poisson distribution with event frequency equal
% to model response
for i =1:length(linModel)
    Probs(i)=poisspdf(round(Data.Data(i)),(linModel(i)*Data.Reps(i)*.15));
end
% Sum the -log(likelihood) of all empirical responses
Prob = -sum(log(Probs));

% Make dOri and MotionDir output variables
dOri=[0:22.5:157.5 157.5:-22.5:22.5 0:22.5:157.5 157.5:-22.5:45 0:22.5:157.5 157.5:-22.5:67.5 0:22.5:157.5 157.5:-22.5:90 0:22.5:157.5 157.5:-22.5:102.5 0:22.5:157.5 157.5 135 0:22.5:157.5 157.5 0:22.5:157.5 0:22.5:157.5 0:22.5:135 0:22.5:112.5 0:22.5:90 0:22.5:67.5 0:22.5:45 0 22.5 0];
MotionDir= [0:11.25:78.75 281.25:11.25:348.75 [0:11.25:78.75 281.25:11.25:337.5]+22.5 [0:11.25:78.75 281.25:11.25:326.25]+45 [0:11.25:78.75 281.25:11.25:315]+67.5 [0:11.25:78.75 281.25:11.25:303.75]+90 [0:11.25:78.75 281.25:11.25:292.5]+112.5 [0:11.25:78.75 281.25]+135 [0:11.25:78.75]+157.5 [0:11.25:78.75]+180 [0:11.25:67.5]+202.5 [0:11.25:56.25]+225 [0:11.25:45]+247.5 [0:11.25:33.75]+270 [0 11.25 22.5]+292.5 [0 11.25]+315 337.5];
MotionDir(MotionDir>=360)=MotionDir(MotionDir>=360)-360;

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API