Iter-Spiking Interval Statistics for CBGTC spike times¶
- class analyseur.cbgtc.stats.isi.InterSpikeInterval[source]¶
Bases:
objectComputes interspike intervals for the given spike times
Methods
Argument
spiketimes_set: Dictionary returned; see
get_spiketimes_superset()also see
get_spiketimes_subset()
isi_set: Dictionary returned; see
compute()
inst_rates_set: Dictionary returned; see
inst_rates()tbins_set: 2nd tuple (Dictionary) returned; see
compute()binsz: [OPTIONAL] 0.01 (default)
isi_set: Dictionary returned; see
compute()
isi_set: Dictionary returned; see
compute()
Use Cases¶
1. Pre-requisites¶
1.1. Import Modules¶
from analyseur.cbgtc.loader import LoadSpikeTimes from analyseur.cbgtc.stats.isi import InterSpikeInterval
1.2. Load file and get spike times¶
loadST = LoadSpikeTimes("spikes_GPi.csv") spiketimes_superset = loadST.get_spiketimes_superset()
2. Cases¶
2.1. Compute Inter-Spike Intervals (for all neurons)¶
[I, all_t] = InterSpikeInterval.compute(spiketimes_superset)
This returns the value for \(I = \left\{\overrightarrow{ISI}^{(i)} \mid \forall{i \in [1, n_{nuc}]} \right\}\); see formula
compute().2.2. Compute Instantaneuous Rates (for all neurons)¶
J = InterSpikeInterval.inst_rates(I)
This returns the value for \(R = \left\{\vec{R}^{(i)} \mid \forall{i \in [1, n_{nuc}]} \right\}\); see formula
inst_rates()2.3. Compute Average Instantaneuous Rates (for all neurons)¶
E = InterSpikeInterval.pool_avg_inst_rates(J, all_t)
This returns the value for \(\vec{\Xi} = [\xi_t]_{\forall{t}}\); see formula
avg_pool_inst_rates()2.4. Compute Mean Frequencies (for all neurons)¶
F = InterSpikeInterval.mean_freqs(I)
This returns the value for \(\vec{F} = \left[\overline{f^{(i)}}\right]_{\forall{i \in [1, n_{nuc}]}}\); see formula
mean_freqs()2.5. Compute Global Mean Frequency¶
grand_f = InterSpikeInterval.grand_mean_freq(I)
This returns the value for \(\overline{f}\); see formula
grand_mean_freq()- classmethod compute(spiketimes_set=None)[source]¶
- \[ \begin{align}\begin{aligned}\overrightarrow{ISI}^{(i)} = \begin{cases} \varnothing & n_{spk}^{(i)} < 2 \\ \left[t_{k+1}^{(i)} - t_k^{(i)}\right] & \text{otherwise} \end{cases}\end{aligned}\end{align} \]
Returns the interspike interval for all individual neurons.
- Parameters:
spiketimes_set – Dictionary returned using
get_spiketimes_superset()
or using
get_spiketimes_subset()- Returns:
2-tuple
dictionary of individual neurons whose values are their respective interspike interval
dictionary of individual neurons whose values are their respective times for corresponding interspike interval
Formula
Definitions
Interpretation
total neurons, \(n_{nuc}\)
total number of neurons in the Nucleus
neuron index, \(i\)
i-th neuron in the pool of \(n_{nuc}\) neurons
total spikes, \(n_{spk}^{(i)}\)
total number of spikes (spike times) by i-th neuron
interspike interval, \(isi_{k}^{(i)}\)
k-th absolute interval between successive spike times
\(\overrightarrow{ISI}^{(i)} = \left[isi_k^{(i)}\right]_{\forall{k \in [1, n_{spk}^{(i)})}}\)
array of all interspike intervals of i-th neuron
\(I = \left\{\overrightarrow{ISI}^{(i)} \mid \forall{i \in [1, n_{nuc}]} \right\}\)
set of array interspike intervals of all neurons
- classmethod grand_mean_freq(isi_set=None)[source]¶
Returns the grand mean frequency which is the mean of mean frequencies of all the neurons
- Parameters:
isi_set – Dictionary returned using
compute()- Returns:
a number
Formula
Definitions
Interpretation
total neurons, \(n_{Nuc}\)
total number of neurons in the Nucleus
neuron index, \(i\)
i-th neuron in the pool of \(n_{Nuc}\) neurons
mean frequency, \(\overline{f^{(i)}}\)
mean spiking frequency of i-th neuron
\(\vec{F} = \left[\overline{f^{(i)}}\right]_{\forall{i \in [1, n_{nuc}]}}\)
array of mean frequencies of all (\(n_{Nuc}\)) neurons
grand mean frequency, \(\overline{f} = \mu\left(\vec{F}\right)\)
grand or global mean spiking frequency
where, \(\mu(\cdot)\) is the arithmetic mean function over the given dimension.
NOTE: The array \(\vec{F}\) is obtained by calling
mean_freqs()
- classmethod inst_rates(isi_set=None)[source]¶
Returns the instantaneous rates for all individual neurons.
- Parameters:
isi_set – Dictionary returned using
compute()- Returns:
dictionary of individual neurons whose values are their respective instantaneous rates
Formula
Definitions
Interpretation
total neurons, \(n_{nuc}\)
total number of neurons in the Nucleus
neuron index, \(i\)
i-th neuron in the pool of \(n_{Nuc}\) neurons
total spikes, \(n_{spk}^{(i)}\)
total number of spikes (spike times) by i-th neuron
interspike interval, \(isi_{k}^{(i)}\)
k-th absolute interval between successive spike times
\(\overrightarrow{ISI}^{(i)} = \left[isi_k^{(i)}\right]_{\forall{k \in [1, n_{spk}^{(i)})}}\)
array of all interspike intervals of i-th neuron
\(I = \left\{\overrightarrow{ISI}^{(i)} \mid \forall{i \in [1, n_{nuc}]} \right\}\)
set of array interspike intervals of all neurons
Then, the instantaneuous rate of i-th neuron is
\[ \begin{align}\begin{aligned}\vec{R}^{(i)} &= \frac{1}{\overrightarrow{ISI}^{(i)}} \\ &= \left[\frac{1}{isi_k^{(i)}}\right]_{\forall{k \in [1, n_{spk}^{(i)})}}\end{aligned}\end{align} \]We therefore get
Definitions
Interpretation
\(\vec{R}^{(i)}\)
array of instantaneous rates of i-th neuron
\(R = \left\{\vec{R}^{(i)} \mid \forall{i \in [1, n_{nuc}]} \right\}\)
set of array of instaneous rates of all (\(n_{Nuc}\)) neurons
- classmethod mean_freqs(isi_set=None)[source]¶
Returns the mean frequencies for all individual neurons.
- Parameters:
isi_set – Dictionary returned using
compute()- Returns:
dictionary of individual neurons whose values are their respective mean frequencies
Formula
Definitions
Interpretation
total neurons, \(n_{nuc}\)
total number of neurons in the Nucleus
neuron index, \(i\)
i-th neuron in the pool of \(n_{Nuc}\) neurons
total spikes, \(n_{spk}^{(i)}\)
total number of spikes (spike times) by i-th neuron
interspike interval, \(isi_{k}^{(i)}\)
k-th absolute interval between successive spike times
\(\overrightarrow{ISI}^{(i)} = \left[isi_k^{(i)}\right]_{\forall{k \in [1, n_{spk}^{(i)})}}\)
array of all interspike intervals of i-th neuron
\(I = \left\{\overrightarrow{ISI}^{(i)} \mid \forall{i \in [1, n_{nuc}]} \right\}\)
set of array interspike intervals of all neurons
Then, the mean spiking frequency of i-th neuron is
\[\overline{f^{(i)}} = \frac{1}{(n_{spk}^{(i)} - 1)} \sum_{j=1}^{(n_{spk}^{(i)} - 1)}\frac{1}{isi_{j}^{(i)}}\]We therefore get
Definitions
Interpretation
\(\overline{f^{(i)}}\)
mean spiking frequency of i-th neuron
\(\vec{F} = \left[\overline{f^{(i)}}\right]_{\forall{i \in [1, n_{nuc}]}}\)
array of mean frequencies of all (\(n_{Nuc}\)) neurons
- classmethod pool_avg_inst_rates(inst_rates_set=None, tbins_set=None, binsz=None)[source]¶
Returns the pooled average instantaneous rates for all individual neurons.
- Parameters:
tbins_set – Dictionary returned using
compute()inst_rates_set – Dictionary returned using
inst_rates()binsz – integer or float; 0.01 [default]
- Returns:
3-tuple
list of average instantaneous rates
array of centers for all the time bins (use this as time axis for plotting)
list of number of data point per bin (can be useful for colorbar)
Formula
Definitions
Interpretation
total neurons, \(n_{nuc}\)
total number of neurons in the Nucleus
neuron index, \(i\)
i-th neuron in the pool of \(n_{Nuc}\) neurons
\(\vec{R}^{(i)}\)
array of instantaneous rates of i-th neuron
\(R = \left\{\vec{R}^{(i)} \mid \forall{i \in [1, n_{nuc}]} \right\}\)
set of array of instaneous rates of all (\(n_{Nuc}\)) neurons
\(\vec{J}^{(i)}\)
array of time points where instantaneous rates of i-th neuron occur
\(J = \left\{\vec{J}^{(i)} \mid \forall{i \in [1, n_{nuc}]} \right\}\)
set of array of time points of all (\(n_{Nuc}\)) neurons
For using bin-based conditional average let
Definitions
Interpretation
\(\vec{P} = vec(J)\)
array containing all the time points from all the neurons
\(\vec{\Xi} = vec(R)\)
array containing all the instantaneous rates from all the neurons
total bins, \(n_{bins} = \mid vec(J) \mid\)
total number of time points from all neurons
bin size, \(w\)
fixed bin width for each time bin
bin center, \(c_{\forall{t} \in [0, n_{bins} - 1]}\)
center of t-th time bin
bin interval, \(b_t = \left[c_t - \frac{w}{2}, c_t + \frac{w}{2}\right)\)
interval of t-th time bin
Then, the average instantaneuous rate for t-th bin is
\[ \begin{align}\begin{aligned}\xi_t &= \mathbb{E}\left[\Xi_p \mid p \in b_t\right] \\ &= \frac{\sum_{p \in P}(\Xi_p \cdot 1_{\{p \in b_t\}})}{\sum_{p \in P} 1_{\{p \in b_t\}}}\end{aligned}\end{align} \]where
\(\mathbb{E}\) is the expectation function,
\(1_{\{p \in b_t\}}\) is the indicator function; 1 if condition is true otherwise 0,
\(\sum_{p \in P} 1_{\{p \in b_t\}}\) is the number of time points that fall in the t-th bin
numerator is the sum of instantaneous rates that fall in the t-th bin
We therefore get
Definitions
Interpretation
\(\xi_t\)
average instantaneous rate for t-th bin
\(\vec{\Xi} = [\xi_t]_{\forall{t}}\)
array of average instantaneous rates for all bins
- classmethod true_avg_inst_rates(inst_rates_set=None)[source]¶
Returns the true average instantaneous rates for all individual neurons.
- Parameters:
tbins_set – Dictionary returned using
compute()inst_rates_set – Dictionary returned using
inst_rates()binsz – integer or float; 0.01 [default]
- Returns:
3-tuple
list of average instantaneous rates
array of centers for all the time bins (use this as time axis for plotting)
list of number of data point per bin (can be useful for colorbar)
Formula
Definitions
Interpretation
total neurons, \(n_{nuc}\)
total number of neurons in the Nucleus
neuron index, \(i\)
i-th neuron in the pool of \(n_{Nuc}\) neurons
\(\vec{R}^{(i)}\)
array of instantaneous rates of i-th neuron
\(R = \left\{\vec{R}^{(i)} \mid \forall{i \in [1, n_{nuc}]} \right\}\)
set of array of instaneous rates of all (\(n_{Nuc}\)) neurons
\(\vec{J}^{(i)}\)
array of time points where instantaneous rates of i-th neuron occur
\(J = \left\{\vec{J}^{(i)} \mid \forall{i \in [1, n_{nuc}]} \right\}\)
set of array of time points of all (\(n_{Nuc}\)) neurons
For using bin-based conditional average let
Definitions
Interpretation
\(\vec{P} = vec(J)\)
array containing all the time points from all the neurons
\(\vec{\Xi} = vec(R)\)
array containing all the instantaneous rates from all the neurons
total bins, \(n_{bins} = \mid vec(J) \mid\)
total number of time points from all neurons
bin size, \(w\)
fixed bin width for each time bin
bin center, \(c_{\forall{t} \in [0, n_{bins} - 1]}\)
center of t-th time bin
bin interval, \(b_t = \left[c_t - \frac{w}{2}, c_t + \frac{w}{2}\right)\)
interval of t-th time bin
Then, the average instantaneuous rate for t-th bin is
\[ \begin{align}\begin{aligned}\xi_t &= \mathbb{E}\left[\Xi_p \mid p \in b_t\right] \\ &= \frac{\sum_{p \in P}(\Xi_p \cdot 1_{\{p \in b_t\}})}{\sum_{p \in P} 1_{\{p \in b_t\}}}\end{aligned}\end{align} \]where
\(\mathbb{E}\) is the expectation function,
\(1_{\{p \in b_t\}}\) is the indicator function; 1 if condition is true otherwise 0,
\(\sum_{p \in P} 1_{\{p \in b_t\}}\) is the number of time points that fall in the t-th bin
numerator is the sum of instantaneous rates that fall in the t-th bin
We therefore get
Definitions
Interpretation
\(\xi_t\)
average instantaneous rate for t-th bin
\(\vec{\Xi} = [\xi_t]_{\forall{t}}\)
array of average instantaneous rates for all bins