Coherence analysis (spynal.sync.coherence)¶
Oscillatory coherence analysis
- coherence(data1, data2, axis=0, return_phase=False, transform=None, single_trial=None, spec_method='wavelet', data_type=None, smp_rate=None, time_axis=None, taper_axis=None, keepdims=True, **kwargs)¶
Compute coherence between pair of channels of raw or spectral (time-frequency) data (LFP or spikes)
Coherence is a spectral analog of linear correlation that takes both phase and amplitude into account.
Only parameters differing from
synchrony()
are described here.- Parameters:
transform ('Z' or None, default: None) – Transform to apply to all computed coherence values. Set=None to return raw, untransformed coherence. Set=’Z’ to Z-transform coherence using Jarvis & Mitra (2001) method.
**kwargs – Any other keyword args passed as-is to spectrogram() function.
- spike_field_coherence(spkdata, lfpdata, axis=0, time_axis=None, taper_axis=None, timepts=None, transform=None, data_type=None, spec_method='multitaper', smp_rate=None, return_phase=False, keepdims=True, **kwargs)¶
Compute pairwise coherence between single-channel spiking data and LFP data
Only parameters differing from
spike_field_coupling()
are described here.- Parameters:
transform ('Z' or None, default: None) – Transform to apply to all computed coherence values. Set=None to return raw, untransformed coherence. Set=’Z’ to Z-transform coherence using Jarvis & Mitra (2001) method.
**kwargs – Any other keyword args passed as-is to spectrogram() function
- ztransform_coherence(coh, df, beta=1.15)¶
z-transform coherence values to render them approximately normally distributed
- Parameters:
coh (ndarray, shape=Any) – Raw coherence values
df (int) – Degrees of freedom of coherence estimates. For multitaper spectral estimates, this is usually df = 2*n_trials*n_tapers. For other estimates, this is usually df = 2*n_trials.
beta (scalar, default: 23/20) – Mysterious number from Jarvis & Mitra to make output z-scores approximately normal
- Returns:
z – z-transformed coherence. Same shape as coh.
- Return type:
ndarray, shape=Any
References
Jarvis & Mitra (2001) Neural Computation https://doi.org/10.1162/089976601300014312
Hipp, Engel, Siegel (2011) Neuron https://doi.org/10.1016/j.neuron.2010.12.027