% # iPoisson_AS22:
%
% Randomly generated Poisson spiketrain input current, with most baseline values
% set to 0.
%
% - Dependencies:
%     - getPoissonGating.m, getGenExtPoissonTotalGating.m, and
%       nonhomPoissonGeneratorSpikeTimes.m (all from default DynaSim install)
%
% - Tags: spiketrains, Poisson, input
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% poisson parameters
baseline=0;     % spikes/s, baseline rate
DC=0;           % spikes/s, steady component of the signal
AC=0;           % spikes/s, oscillatory component of the signal
f=0;            % Hz, modulation frequency of the signal
phi=0;          % radians, phase at which the signal begins
onset=0;        % ms, start time of signal
offset=inf;     % ms, stop time of signal

% synaptic parameters
gext=0;         % mS/cm^2, maximal synaptic conductance
Eext=0;         % mV, synaptic reversal potential
tau=2;          % ms, synaptic time constant

% poisson conductance
s=getPoissonGating(baseline,DC,AC,f,phi,onset,offset,tau,T,Npop);

% scaled conductance
gPoisson(t)=gext.*s(k,:)

% input synaptic current
IPoisson_AS22(X)=-gPoisson(t).*(X-Eext);

% monitor
monitor gPoisson

% linker
@current += IPoisson_AS22(X)