Wavelet Transform of CBGTC spike times¶
- class analyseur.cbgtc.stats.wavelet.ContinuousWaveletTransform[source]¶
Bases:
objectContinuous Wavelet Transform¶
Methods
Argument
- spiketimes_set: see
get_spiketimes_superset
- spiketimes_set: see
all_neurons_isi: Dictionary returned; see
compute()
all_inst_rates: Dictionary returned; see
inst_rates()all_times: 2nd tuple (Dictionary) returned; see
compute()binsz: [OPTIONAL] 0.01 (default)
all_neurons_isi: Dictionary returned; see
compute()
all_neurons_isi: Dictionary returned; see
compute()
Comments on Activity and Choices in Performing CWT¶
Activity
Description
Purpose
Signal Smoothing
converts binary spike trains to continuous signals
some smoothing can help visualize rhythmic spiking
over smoothing can obscure precise timing
scales
defines the frequencies analyzed
smaller scales for high frequencies and larger for lower frequencies
voices per ocatve ≜ number of scales between 2 frequencies (≜ octave)
higher voices per octave give smoother scalogram but increased computation
wavelet choice
determines trade-off between time and frequency resolution
Morlet (“cmorB-C”) for oscillation
Mexican hat (“mexh”) for transient spike detection
Compute the Continuous Wavelet Transform as the average of the wavelet transform of the neurons in a population
spiketimes_set – Dictionary returned using
get_spiketimes_superset()or using
get_spiketimes_subset()[OPTIONAL]
sampling_rate – 1000/dt = 10000 Hz [default]; sampling_rate ∊ (0, 10000)
window – Tuple in the form (start_time, end_time); (0, 10) [default]
sigma – standard deviation value, 2 [default]
wavelet – “cmor1.5-1.0” [default], for possible options see pywt.cwt
scales – Tuple; (1, 128) [default]
4-tuple
array of mean of coefficients of power spectral density
array of sample frequencies
list of neuron id’s
array of time
Compute the Continuous Wavelet Transform on the sum of signals across neurons in a population.
spiketimes_set – Dictionary returned using
get_spiketimes_superset()or using
get_spiketimes_subset()[OPTIONAL]
sampling_rate – 1000/dt = 10000 Hz [default]; sampling_rate ∊ (0, 10000)
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
sigma – standard deviation value, 2 [default]
wavelet –
”cmor1.5-1.0” [default], for possible options see pywt.cwt
scales – Tuple; (1, 128) [default]
4-tuple
array of mean of coefficients of power spectral density
array of sample frequencies
list of neuron id’s
array of time
Returns the array of scales between octaves given
freq_window – Tuple (min_freq, max_freq)
voices_per_octave – scalar
wavelet –
name of wavelet type available in pywt.cwt
sampling_rate – 1000/dt = 10000 Hz [default]; sampling_rate ∊ (0, 10000)
Parameter
Description
Comment
frequency range
match signal’s expected content
1-100 Hz (neuron spikes)
Voices Per Octave (VPO)
VPO ∝ frequency resolution
VPO ∝ 1/computational cost
10-16 (general)
32 (high precision analysis)
wavelet choice
time/frequency resolution trade-off
“cmorB-C” (good for neural data)
Scales defines the frequencies in the wavelet transform analysis.
\(s_a < s_b \overset{\frown}{=} f_a > f_b\) where scale \(s_x\) corresponds to frequency \(f_x\)
Voices per octave controls the number of scales between consecutive frequencies (≜ octave)
In other words, the number of scales between octaves is the voices per octave
Converts a scale value to its corresponding frequency value.
scale – a scalar
wavelet –
name of wavelet type available in pywt.cwt
sampling_rate – 1000/dt = 10000 Hz [default]; sampling_rate ∊ (0, 10000)
a frequency value
Scale vs Frequency
Scale vs Voices/Octave
Scales defines the frequencies in the wavelet transform analysis.
Voices per octave controls the number of scales between consecutive frequencies (≜ octave)
\(s_a < s_b \overset{\frown}{=} f_a > f_b\) where scale \(s_x\) corresponds to frequency \(f_x\)
In other words, the number of scales between octaves is the voices per octave
This method takes the spike times and converts it into respective binary spike trains which in turn is smoothened. The returned smoothened signal can be used to create a firing rate signal.
spiketimes_set – Dictionary returned using
get_spiketimes_superset()or using
get_spiketimes_subset()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
sigma – standard deviation amount from a mean; 2 [default]
sampling_rate – 1000/dt = 10000 Hz [default]; sampling_rate ∊ (0, 10000)
4-tuple
smooth signal
list of neuron id’s
time axis
sampling period
Smoothening is done by Gaussian filtering¶
each binary spike (= 1) is placed into a Gaussian-shaped bump
the overall result is many Gaussian distributions (each per point when spike = 1)
where spikes are close the Gaussians overlap
this represents the “dense estimate” of the spikes, i.e, smoothened curve
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
\(\vec{S}^{(i)}\)
array of spike times of i-th neuron
\(S = \left\{\vec{S}^{(i)} \mid \forall{i \in [1, n_{nuc}]} \right\}\)
set of spike times of all neurons
\(\vec{B}^{(i)} = \left[\sum_{k=1}^{n_{spk}^{(i)}} \delta[t - t_k]\right]_{\forall{t} \in [t_1, t_{n_{spk}^{(i)}}]}\)
binary spike train of i-th neuron for spike times \(\vec{S}^{(i)}\) at \(t_1, t_2, ..., t_{n_{spk}^{(i)}}\)
\(B = \left\{\vec{B}^{(i)} \mid \forall{i \in [1, n_{nuc}]} \right\}\)
set of spike trains of all neurons
\(\vec{G} = \left[\frac{1}{\sigma \sqrt{2\pi}}e^{-\frac{k^2}{2\sigma^2}}\right]_{\forall{k}}\)
Gaussian kernel
Then, the smoothened signal for i-th neuron is
Note that the last line is due to the fact that only non-zero \(B^{(i)}[t_k]\) occurs at spike positions.