# RgcCalculateSpikesByLayer

### From VISTA LAB WIKI

Calculate RGC spikes from network, simulation and the full time series. This uses a Poisson process, for which there is more details there.

# [edit] Use

[spkHist spkTS] = rgcCalculateSpikesByLayer(ConnecMatrix, linTS, layer, spikeRateGain, saveSpikeData, savingFile)

# [edit] Inputs

- spikeRateGain : the rate of the Poisson spiking process is
- spikeRateGain*exp(linTS+expTS).
- saveSpikeData : 1 if you want the spikeData saved to a file, 0 if not.
- savingFile : the name of the file to save in. If it's not given, the data is saved at the root (~).

# [edit] Comments

The interconnection matrix (ConnecMatrix), driving linear input (linTS), and retinal ganglion cell parameters (layer of rgcP) are input. The spike history is returned in spkHist. The time series at each neuron, accounting for the input, coupling, and feedback, is returned in spkTS.

- The menbrane potential of the neurons, rgcV, is the sum of several inputs:
- linTS (linear time series, matrix of size nRGC*nFrames) : the result of the convolution of the cone absorptions with the Receptive Field (RF) of the neurons. This is the sensory input. Each line corresponds to a neuron, each column to a time step.
- spkTS (spike time series, matrix of size nRGC*nFrames) : the sum of current feedback and coupling voltages (see fbTR and cpTR). Each line corresponds to a neuron, each column to a time step.
- randV (matrix of size nRGC*nFrames): a random voltage (gaussian of mean rgcP.meanV and standard deviation rgcP.stdV), added to linTS. This models the noise coming from... ?

- When a neuron spikes, it triggers two responses :
- fbTR (feedback time response, line vector of length length(fbTR)) : when a neuron spikes, it triggers an additional voltage input to its membrane potential, which has a particular evolution over time. fbTR is the value of this feedback voltage over time. Each time a neuron spikes, we start a new feedback response voltage and add it to spkTS, starting at the current time step.
- cpTR (coupling time response, line vector of length length(cpTR)) : when a neuron spikes, it starts a coupling voltage in the neurons it is connected to (see connexion matrix). cpTR is the vector of values of this coupling voltage over time. It works in the same way as fbTR, except it is added to neighboring neurons' spkTS.

- At each time step, linTS and spkTS are added to the current membrane potential rgcV, to make the rgcV of the next time step : this is equivalent to an integrator on rgcV, with added exterior inputs at each time step.

- The connection matrix (ConnecMatrix) contains, for each neuron, the list of its connected neighbors, and the gain of that connexion. The farther away the neighbor is, the lower the gain is. The fbTR issued by a spiking neuron is multiplied by this gain before being added to the neighbor neuron's spkTS (we can see this gain as a pipe's debit or a channel's dimming.).

- The generation of spikes follows a probabilistic process. The higher the membrane potential rgcV is, the higher the spiking probability (see [[Spike generation using a Poisson process)]]). The spikes of each time step are stored in spkHist (a nGRC*nFrames matrix of 0 and 1).