neurotools.signal.coherence module
Routines for calculating coherence
- neurotools.signal.coherence.morlet_population_synchrony_spectrum(lfp, fa, fb, w=4.0, resolution=0.1, Fs=1000)[source]
First dimension is nchannels, second is time. Use morlet wavelets ( essentially bandpass filter bank ) to compute short-timescale synchrony. for each band: take morlet spectrum over time. take kuromoto or synchrony measure over complex vectors attained
- neurotools.signal.coherence.population_eigencoherence(lfp, fa, fb, w=4.0, resolution=0.1, Fs=1000)[source]
Uses the eigenvalue spectrum of the pairwise coherence matrix. In the case of wavelets, each time-frequency point has one complex value. The matrix we build will be I think $|z_i z_j|$ … this will involve a lot of computation. … let’s not do it. See ramirez et al A GENERALIZATION OF THE MAGNITUDE SQUARED COHERENCE SPECTRUM FOR MORE THAN TWO SIGNALS: DEFINITION, PROPERTIES AND ESTIMATION
- neurotools.signal.coherence.population_coherence_matrix(lfp)[source]
lfp is a Nch×NTime matrix of data channels. ntapers is a positive integer. For each pair of channels compute multitaper coherence. take the product of each taper with each channel and take the FT
- neurotools.signal.coherence.multitaper_coherence(x, y, Fs=1000, BW=5)[source]
BW is the multitaper bandwidth returns freqs, cohere
- neurotools.signal.coherence.sliding_multitaper_coherence(x, y, window=500, step=100, Fs=1000, BW=5)[source]
Sliding multitaper coherence between x and y This is a somewhat strange implementation that is only preserved for legacy reasons.
- neurotools.signal.coherence.sliding_multitaper_coherence_parallel(x, y, window=500, step=100, Fs=1000, BW=5)[source]
Sliding multitaper coherence between x and y Takes multiple samples over time, but estimates each sample using multi-taper See also multitaper_coherence This is a somewhat strange implementation that is only preserved for legacy reasons.
- neurotools.signal.coherence.coherence_pvalue(C, NSample, beta=1.15)[source]
Jarvis & Mitra (Neural Comp., 2001, p732) Pesaran et al. (Nature, 2008, supp info, p5)
beta = 23/20. Jarvis & Mitra suggest (Neural Comp., 2001, p732) Pesaran et al. suggest beta=1.5 (Nature, 2008, supp info, p5)
citep{jarvis2001sampling, pesaran2008free}
- neurotools.signal.coherence.multitaper_multitrial_coherence(x, y, Fs=1000, NT=5)[source]
Computes coherence over multiple tapers and multiple trials
x: data. NVariables×NTrials×NTime
NTapers: number of tapers, defaults to 5
- bootstrap: defaults to 100
If bootstrap is a positive integer, we will perform bootstrap resampling and return this distribution along with the coherence result.
- unbiased: defaults to True
If true it will apply the standard bias correction for averaging of circular data, which should remove sample-size dependence for the coherence values, at the cost of increasing estimator variance and occassionally generating strange (negative) coherence values. Bias correction for magnitude squared is (N|z|²-1)/(N-1)
Procedure: 1 Z-score each trial (removes mean) 2 Generate tapers 3 Compute tapered FFTs for all trials and tapers 4 Cross-spectral density
return freqs, coherence, bootstrapped