Rate Statistics of CBGTC spike times¶
- class analyseur.cbgtc.stats.rate.Rate[source]¶
Bases:
objectUse Cases¶
1. Pre-requisites¶
1.1. Import Modules¶
from analyseur.cbgtc.loader import LoadSpikeTimes from analyseur.cbgtc.stats.rate import Rate
1.2. Load file and get spike times¶
loadST = LoadSpikeTimes("spikes_GPi.csv") spiketimes_superset = loadST.get_spiketimes_superset()
2. Cases¶
2.1. Compute spike count observables¶
count_matrix, rate_matrix, time_bins = Rate.get_count_rate_matrix( spiketimes_set=spiketimes_superset)
2.2. Compute spike count observables within a desired window for a select neurons¶
count_matrix, rate_matrix, time_bins = Rate.get_count_rate_matrix( spiketimes_set=spiketimes_superset, window=(3,8), binsz=0.5, neurons=[2, 3, 6, 7])
2.3. Compute mean firing rate from all given neurons across all neurons¶
mu_rate_vec, time_bins = Rate.mean_rate( spiketimes_set=spiketimes_superset, neurons="all", across="neurons")
2.4. Compute mean firing rate from all given neurons across all times¶
mu_rate_vec, time_bins = Rate.mean_rate( spiketimes_set=spiketimes_superset, neurons="all", across="times")
- classmethod get_count_rate_matrix(spiketimes_set=None, window=None, binsz=None, neurons='all')[source]¶
Returns the spike count and firing rate matrices for all neurons.
- Parameters:
spiketimes_set – Dictionary returned using
get_spiketimes_superset()
or using
get_spiketimes_subset()- Parameters:
binsz – integer or float; 0.01 [default]
window – Tuple in the form (start_time, end_time); (0, 10) [default]
neurons –
“all” [default] or scalar or range(a, b) or list of neuron ids like [2, 3, 6, 7]
”all” means subset = superset
N (a scalar) means subset of first N neurons in the superset
range(a, b) or [2, 3, 6, 7] means subset of selected neurons
- Returns:
spike count matrix, firing rate matrix and time bins
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
spike time, \(s^{(i)}\)
an arbitrary spike time of i-th neuron
bin size, \(\beta\)
width of each time bin as discrete interval
function, \(I(x) = \{1 \text{ if } x \text{ is true else } 0\}\)
indicator function which equals 1 if condition inside is true and 0 otherwise
spike count, \(c^{(i)}(t) = \sum_{k} I(t \cdot \beta \le s^{(i)}_k < (t+1) \cdot \beta)\)
number of spikes of the i-th neuron at time \(t\)
spike count matrix, \(C = \left[c(a,b) = c^{(a)}(b)\right]_{\forall{a \in [1, n_{Nuc}], b \in [t_0, t_T]}}\)
spike counts of all (\(n_{Nuc}\)) neurons for all times
firing rate, \(f^{(i)}(t) = \frac{c^{(i)}(t)}{\beta}\)
firing rate of the i-th neuron at time \(t\) with bin size \(\beta\)
firing rate matrix, \(F = \left[f(a,b) = f^{(a)}(b)\right]_{\forall{a \in [1, n_{Nuc}], b \in [t_0, t_T]}}\)
rates of all (\(n_{Nuc}\)) neurons for all times
Spike Count Matrix
\[ \begin{align}\begin{aligned}C = \overset{\begin{matrix}t_0 & \quad\quad & t_1 & & & &\ldots & & & t_T\end{matrix}} {\begin{bmatrix} c^{(1)}(t_0) & c^{(1)}(t_1) & \ldots & c^{(1)}(t_T) \\ c^{(2)}(t_0) & c^{(2)}(t_1) & \ldots & c^{(2)}(t_T) \\ \vdots & \vdots & \ldots & \vdots \\ c^{(i)}(t_0) & c^{(i)}(t_1) & \ldots & c^{(i)}(t_T) \\ \vdots & \vdots & \ldots & \vdots \\ c^{(n_{Nuc})}(t_0) & c^{(n_{Nuc})}(t_1) & \ldots & c^{(n_{Nuc})}(t_T) \end{bmatrix} }\end{aligned}\end{align} \]Firing Rate Matrix
\[ \begin{align}\begin{aligned}F = \overset{\begin{matrix}t_0 & \quad\quad & t_1 & & & &\ldots & & & t_T\end{matrix}} {\begin{bmatrix} f^{(1)}(t_0) & f^{(1)}(t_1) & \ldots & f^{(1)}(t_T) \\ f^{(2)}(t_0) & f^{(2)}(t_1) & \ldots & f^{(2)}(t_T) \\ \vdots & \vdots & \ldots & \vdots \\ f^{(i)}(t_0) & f^{(i)}(t_1) & \ldots & f^{(i)}(t_T) \\ \vdots & \vdots & \ldots & \vdots \\ f^{(n_{Nuc})}(t_0) & f^{(n_{Nuc})}(t_1) & \ldots & f^{(n_{Nuc})}(t_T) \end{bmatrix} }\end{aligned}\end{align} \]
- classmethod mean_rate(spiketimes_set=None, window=None, binsz=None, neurons='all', across=None)[source]¶
Returns the mean firing rate from all neurons.
- Parameters:
spiketimes_set – Dictionary returned using
get_spiketimes_superset()
or using
get_spiketimes_subset()- Parameters:
binsz – integer or float; 0.01 [default]
window – Tuple in the form (start_time, end_time); (0, 10) [default]
neurons –
“all” or scalar or range(a, b) or list of neuron ids like [2, 3, 6, 7]
”all” means subset = superset
N (a scalar) means subset of first N neurons in the superset
range(a, b) or [2, 3, 6, 7] means subset of selected neurons
across – “neurons” or “times”
- Returns:
mean rate and time bins
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
frequency, \(f^{(i)}(t)\)
frequency of the i-th neuron at time \(t\)
frequency matrix, \(F = \left[f(a,b) = f^{(a)}(b)\right]_{\forall{a \in [1, n_{Nuc}], b \in [t_0, t_T]}}\)
frequencies of all (\(n_{Nuc}\)) neurons for all times
Formula: Mean Rate across = “neurons”
\[ \begin{align}\begin{aligned}F = \overset{\begin{matrix}t_0 & \quad\quad & t_1 & & & &\ldots & & & t_T\end{matrix}} {\underset{ \begin{matrix} \quad\quad\downarrow & \quad\quad\quad & \downarrow & \quad &\ldots & & & \downarrow \\ \quad\mu_{t_0} & \quad\quad\quad & \mu_{t_1} & \quad &\ldots & & & \mu_{t_T} & \quad \quad \end{matrix}} {\begin{bmatrix} f^{(1)}(t_0) & f^{(1)}(t_1) & \ldots & f^{(1)}(t_T) \\ f^{(2)}(t_0) & f^{(2)}(t_1) & \ldots & f^{(2)}(t_T) \\ \vdots & \vdots & \ldots & \vdots \\ f^{(i)}(t_0) & f^{(i)}(t_1) & \ldots & f^{(i)}(t_T) \\ \vdots & \vdots & \ldots & \vdots \\ f^{(n_{Nuc})}(t_0) & f^{(n_{Nuc})}(t_1) & \ldots & f^{(n_{Nuc})}(t_T) \end{bmatrix} }}\end{aligned}\end{align} \]Formula: Mean Rate across = “times”
\[ \begin{align}\begin{aligned}F = \overset{\begin{matrix}t_0 & \quad\quad & t_1 & & & &\ldots & & & t_T\end{matrix}} {\begin{bmatrix} f^{(1)}(t_0) & f^{(1)}(t_1) & \ldots & f^{(1)}(t_T) \\ f^{(2)}(t_0) & f^{(2)}(t_1) & \ldots & f^{(2)}(t_T) \\ \vdots & \vdots & \ldots & \vdots \\ f^{(i)}(t_0) & f^{(i)}(t_1) & \ldots & f^{(i)}(t_T) \\ \vdots & \vdots & \ldots & \vdots \\ f^{(n_{Nuc})}(t_0) & f^{(n_{Nuc})}(t_1) & \ldots & f^{(n_{Nuc})}(t_T) \end{bmatrix} } \begin{matrix} \rightarrow & \mu^{(1)} \\ \rightarrow & \mu^{(2)} \\ \vdots & \vdots \\ \rightarrow & \mu^{(i)} \\ \vdots & \vdots \\ \rightarrow & \mu^{(n_{Nuc})} \end{matrix}\end{aligned}\end{align} \]