function [Y1,Y2,Ch,RTsacc]=MODE_lip_FD01(x1,x2,num,A9,B9,g_f,g_h,lambda,sigLIP,pre_y,muu,n_f,n_h,Tsacc,g_BG,g_delay)
%
% MODE_lip_FD01 :: Function that computes the lateral intraparietal responses in each trial of the fixed duration task (Shadlen & Newsome, 2001)
%
%% Input variables
% x1 :: Vector containing dynamic population activity of medial superior
% temporal area neurons tuned to rightward direction in some trial
%
% x2 :: Vector containing dynamic population activity of medial superior
% temporal area neurons tuned to leftward direction in some trial
%
% num :: Number of time steps for which the lateral intraparietal responses
% are computed
%
% A9 :: Parameter that scales passive decay in lateral intraparietal
% neuronal responses
%
% B9 :: Maximal rate of the model lateral intraparietal neurons
%
% g_f :: Parameter that scales the gain of self-excitation in lateral
% intraparietal recurrent competitive field
%
% g_h :: Parameter that scales the gain of recurrent inhition in lateral
% intraparietal recurrent competitive field
%
% lambda :: Parameter that scales the bottom-up excitation to a lateral
% intraparietal cellfrom the media superior temporal pool tuned to the
% preferred direction
%
% sigLIP :: Standard deviation of the Brownian motion process that injects
% noise into the dynamics of lateral intraparietal area neurons
%
% pre_y :: Pre-motion onset period rate of each model lateral intraparietal
% neuron whose receptive field contains a choice target
%
% muu :: Threshold parameter of the recurrent signal functions in the
% lateral intraparietal recurrent competitive field
%
% n_f :: Steepness parameter of the self-excitatory signal function in the
% lateral intraparietal recurrent competitive field
%
% n_h :: Steepness parameter of the recurrent inhibitory signal function in
% the lateral intraparietal recurrent competitive field
%
% Tsacc :: Rate of the selected lateral intraparietal cell when the saccade
% is initiated
%
% g_BG :: Parameter that scales the gain of self-excitation for the selected
% lateral intraparietal call after decision threshold-crossing
%
% g_delay :: Parameter that scales the gain of self-excitation during the
% variable delay period for the selected lateral intraparietal cell
%
%% Output variables
% Y1 :: Vector containing dynamic activity of lateral intraparietal cell tuned to rightward directional choice in the trial
%
% Y2 :: Vector containing dynamic activity of lateral intraparietal cell tuned to leftward directional choice in the trial
%
% Ch :: (1 if the choice is rightward direction, 2 otherwise)
%
% RTsacc :: Time (in ms) from motion onset when the saccade is made in the
% trial
%
%% NOTE
% If RTsacc=0 or Ch=-1 is returned, it implies no choice was made by the model
% monkey in the recorded time
%
%% Reference
% Grossberg, S. and Pilly, P. K. (2008). Temporal dyanamics of decision-making during motion perception in the visual cortex. Vision Research, 48(12), 1345-1373.
%
%% Author
% Praveen K. Pilly (advaitp@gmail.com)
%
%% License policy
% Written by Praveen K. Pilly, Department of Cognitive and Neural Systems, Boston University
% Copyright 2009, Trustees of Boston University
%
% Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted
% without fee, provided that the above copyright notice and this permission notice appear in all copies, derivative works and
% associated documentation, and that neither the name of Boston University nor that of the author(s) be used in advertising or
% publicity pertaining to the distribution or sale of the software without specific, prior written permission. Neither Boston
% University nor its agents make any representations about the suitability of this software for any purpose. It is provided "as
% is" without warranty of any kind, either express or implied. Neither Boston University nor the author indemnify any
% infringement of copyright, patent, trademark, or trade secret resulting from the use, modification, distribution or sale of
% this software.
%
%% Last modified
% June 25, 2009
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Initializations
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
y1=zeros(1,num);
y2=zeros(1,num);
RTsacc=0;
Ch=-1;
% Neurophysiological data comes from Shadlen & Newsome, 2001
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Parameters
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% A9=5; % note the change in this parameter value from the RT task
% B9=60; % chosen based on neurophysiological data
% g1=2;
% g2=2;
% g_h=7.5;
% lambda=3;
% Tsacc=50; % saccade initiation threshold; chosen from neurophysiological data
% pre_y=15; % pre-motion onset period activity (equilibrated); chosen based
% on neurophysiological data
GI=0; % Inhibitory higher-level signal that is invoked when the eyes begin
% to move
g1=g_f;
g2=g_f;
% fixed time step of numerical integration
dt=0.001; % (in sec)
flg1=-1; % detects saccade beginning
% Bottom-up input due to the target present in LIP cell receptive field
Tc=pre_y*(A9+g_h*hsigm(pre_y,muu,n_h))/(B9-pre_y)-g1*fsigm(pre_y,muu,n_f);
y1(1)=pre_y;y2(1)=pre_y;
% In 2001 FD task, the GO signal can be given anytime between 200 ms and
% 2000 ms from motion offset
Trand=200+round(1800*rand); % random time in msec after motion onset when the GO signal is given
tnGO=1+round(1/dt)+round(Trand/(1000*dt)); % converting into time steps
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for j=2:num
if j<=1+(1/dt) % Stimulus is ON only for 1 sec
k=j-1;
else
k=(1/dt);
lambda=0; % Motion stimulus is shut off after 1 sec
end
y1(j)=y1(j-1)+dt*[-A9*y1(j-1)+(B9-y1(j-1))*(lambda*x1(k)+Tc+g1*fsigm(y1(j-1),muu,n_f))-y1(j-1)*(g_h*hsigm(y2(j-1),muu,n_h)+GI)]+(sqrt(dt))*sigLIP*randn;
y2(j)=y2(j-1)+dt*[-A9*y2(j-1)+(B9-y2(j-1))*(lambda*x2(k)+Tc+g2*fsigm(y2(j-1),muu,n_f))-y2(j-1)*(g_h*hsigm(y1(j-1),muu,n_h)+GI)]+(sqrt(dt))*sigLIP*randn;
% Decision is made in favor of the more active LIP population at the
% end of 1 sec
if j==1+(1/dt)
if y1(j)>=y2(j)
Ch=1;
g1=g_delay;
else
Ch=2;
g2=g_delay;
end
end
if j==tnGO
if Ch==1;
g1=g_BG;
elseif Ch==2
g2=g_BG;
end
end
if flg1<0
if max(y1(j),y2(j))>Tsacc
GI=30; % simulates post-saccadic suppression of LIP responses
% Once the eyes begin to move, bottom-up input from the form
% stream does not exist anymore
Tc=0;
flg1=1; % signifies the choice saccade has begun
RTtn=j; % recording the reaction time step
end
end
end
Y1=rect(y1);
Y2=rect(y2);
RTsacc=(RTtn-1)*dt*1000; % converting the saccadic initiation time into msec
return