Skip to content

random_raster.m

Calvin Eiber edited this page Jun 30, 2021 · 1 revision

Generate a random raster of axon spikes following the specified non-stationary population firing rate, for models.nerve_recording. Two syntaxes will be supported:

raster = random_raster(time, g_xy, [opts]) % used by models.nerve_recording
raster = models.random_raster( 'name',value, ... ) % NOT IMPLEMENTED YET

Several non-stationary population codes are supported (as detailed below) as well as stationary (Poisson) spiking. Within a population of the specified size, individual axons' spike-rates are lognormally distributed around the population average spike-rate. Specifically, if the population spike-rate is some value $\overline{R(t)}$, and the intra-population coherence has been set to some value $\sigma_{pop}$ using .ax_sd = val then the spike-rate $R_{ax}(t)$ for a given axon within the population is given by

$$R_{ax}(t) \sim \overline{R(t)} * e^{ \sigma * normal(0,1) }$$

Built-in temporal patterns:

stationary

.type = 'poisson' (or 'stationary' or 'flat'):

$$\overline{R(t)} = c$$

Parameters (fields of opts) and default values:

  • .fb [2] = $c$ : baseline, imp/s (constant rate)

raised-cosine (burst)

.type = 'raised_cosine' (or 'cos'):

$$\overline{R(t)} = (r_{peak} - r_{base}) \Big( \frac{\cos(2 \pi f t + \phi) + 1}{2} \Big) ^{a} + r_{base}$$

Parameters (fields of opts) and default values:

  • .fb [2] = $r_{base}$ : baseline, imp/s
  • .fp [40] = $r_{peak}$ : max spikerate, imp/s
  • .ph [0] = $\phi$ : phase offset, radians
  • .fc [30] = $f$ : frequency of population firing-rate modulation, Hz
  • .ex [4] = $a$ : exponent

double-exponential (pulse)

.type = 'double_exponential' (or 'exp2') :

$$\overline{R(t)} = \begin{cases} r_{base},&t<t_0 \\\ r_{base} + (r_{peak}-r_{base}) \Big( 1 - e^{ (t_0-t) / \tau_1) } \Big) \Big( e^{ (t_0-t) / \tau_2) } \Big) ,& t \ge t_0 \end{cases}$$

Parameters (fields of opts) and default values:

  • .fb [2] = $r_{base}$ : baseline, imp/s
  • .fp [40] = $r_{peak}$ : peak, imp/s (note that the peak might not achieve that value if $\tau_1$ is not much less than $\tau_2$
  • .t0 [0] = $t_0$ : onset time, ms
  • .tau1 [] = $\tau_1$ : onset time constant, ms
  • .tau2 [] = $\tau_2$ : decay time constant, ms

sigmoid step function (step, drift)

.type = 'step_function' (or 'step') :

$$\overline{R(t)} = \frac{r_{final} - r_{init}}{1 + e^{(t_{50} - t) / \tau}} + r_{init}$$

Parameters (fields of opts) and default values:

  • .fb [2] = $r_{init} : starting rate, imp/s
  • .fp [40] = $r_{final}$ : ending rate, imp/s
  • .t0 [0] = $t_{50}$ : half-maximal time, ms
  • .ex [4] = $\tau$ : 1 / slope of step at half-maximal point, ms.

The step covers ~46% of the difference between peak and base in the time between $t_{50} - \tau$ and $t_{50} + \tau$

Other options:

  • .dt [1]: bin size for spike-rate histogram
  • .ax_sd [1]: imp/s, intra-population coherence
  • .pop_dist 'lognormal' : if set to 'normal', use a modified population coherence equation:
$$R_{ax}(t) \sim \overline{R(t)} + \overline{R(t)} * \sigma * normal(0,1)$$

Other options for file output:

note: these mostly not implemented yet

  • -mat: save output as .mat file
  • -xml: save output as .xml file
  • -json : save output as .json file
  • -roi [start end] or [0 end]: duration of simulated spike-train
  • -count [n_axons] : number of axons in population

Output structure:

Field Type Description
spk_time double nSpikes x 1 time of the nth spike (at the reference spatial location, wherever that is decided to be by the code utilising this output)
spk_axon integer nSpikes x 1 axon ID of the nth spike
spk_rate double 1 x nBins binned population spike_rate (as generated)
bin_time double 1 x nBins time vector for binned population spike-rate
bin_rate double 1 x nBins target population spike_rate (from input arguments)
pop_rate double 1 x nTime target population spike_rate, interpolated to match input time vector defined in the input arguments
axon_group double nAxons x 1 (sample_id).(fascicle_id) for each axon in this population (see axons.mat)
Clone this wiki locally