Phase-based synchrony (spynal.sync.phasesync)¶
Phase-based oscillatory neural synchrony analysis
- plv(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 phase locking value (PLV) between raw or spectral (time-frequency) LFP data.
PLV is a measure of phase synchrony that ignores signals amplitudes.
PLV is the mean resultant length (magnitude of the vector mean) of phase differences dphi btwn phases of data1 and data2:
dphi = phase(data1) - phase(data2) PLV = abs( trial_mean(exp(i*dphi)) )
Only parameters differing from
synchrony()
are described here.- Parameters:
transform ('PPC' or None, default: None) – Transform to apply to all computed PLV values. Set=None to return untransformed PLV. Set=’PPC’ to transform to debiased estimator of PLV^2 (aka Pairwise Phase Consistency/PPC).
**kwargs – Any other keyword args passed as-is to spectrogram() function.
References
Lachaux (1999) https://doi.org/10.1002/(SICI)1097-0193(1999)8:4%3C194::AID-HBM4%3E3.0.CO;2-C
- phase_locking_value(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)¶
Alias of
plv()
. See there for details.
- ppc(data1, data2, axis=0, return_phase=False, single_trial=None, spec_method='wavelet', data_type=None, smp_rate=None, time_axis=None, taper_axis=None, keepdims=True, **kwargs)¶
Compute pairwise phase consistency (PPC) between raw or spectral (time-frequency) LFP data, which is bias-corrected (unlike PLV and coherence, which are biased by n)
PPC is a measure of phase synchrony that ignores signal amplitude.
PPC computes the cosine of the absolute angular distance (the vector dot product) for all given pairs of relative phases, i.e., it computes how similar the relative phase observed in one trial is to the relative phase observed in another trial
PPC is also an debiased estimator of the square of the mean resultant length (PLV^2), and can be expressed (and computed efficiently) in terms of PLV and n:
PPC = (n*PLV^2 - 1) / (n-1)
Only parameters differing from
synchrony()
are described here.- Parameters:
**kwargs – Any other keyword args passed as-is to spectrogram() function.
References
Original concept: Vinck et al. (2010) https://doi.org/10.1016/j.neuroimage.2010.01.073
Relation to PLV: Kornblith, Buschman, Miller (2015) https://doi.org/10.1093/cercor/bhv182
- pairwise_phase_consistency(data1, data2, axis=0, return_phase=False, single_trial=None, spec_method='wavelet', data_type=None, smp_rate=None, time_axis=None, taper_axis=None, keepdims=True, **kwargs)¶
Alias of
ppc()
. See there for details.
- spike_field_plv(spkdata, lfpdata, axis=0, time_axis=None, taper_axis=None, timepts=None, width=0.5, spacing=None, lims=None, timewins=None, data_type=None, spec_method='wavelet', smp_rate=None, return_phase=False, keepdims=True, **kwargs)¶
Compute phase locking value (PLV) of spike-triggered LFP phase
PLV is the mean resultant length (magnitude of the vector mean) of the spike-triggered LFP phase ‘phi’:
PLV = abs( trial_mean(exp(i*phi)) )
Because spiking response are sparse, spike-LFP PLV is typically computed within sliding time windows (ie summation across trials AND across within-window timepoints). These can be specified either explicitly using timewins or implicitly using width/spacing/lims.
Only parameters differing from
spike_field_coupling()
are described here.- Parameters:
width (scalar, default: 0.5 (500 ms)) – Width (in s) of sliding time windows for computing PLV
spacing (scalar, default: set = width (ie exactly non-overlapping windows)) – Spacing (in s) of sliding time windows for computing PLV
lims (array-like, shape=(2,), default: (timepts[0],timepts[-1]) (full sampled time of data)) – [Start,end] time limits (in s) for full series of sliding windows
timewins (ndarray, shape=(n_timewins,2), default: setup_sliding_windows(width,lims,spacing)) –
Alternative method for setting sliding time windows; overrides width/spacing/lims. Custom time windows to compute PLV within, given as explicit series of window [start,end]’s (in s). Can have any arbitrary width/spacing (eg to compute PLV in arbitary time epochs). Default generates sliding windows with width and spacing from lims[0] to lims[1]
Special case: Set = (lim[0],lim[1]) to compute PLV spectrum over entire data time period.
**kwargs – Any other keyword args passed as-is to spectrogram() function.
References
Lachaux (1999) https://doi.org/10.1002/(SICI)1097-0193(1999)8:4%3C194::AID-HBM4%3E3.0.CO;2-C
- spike_field_phase_locking_value(spkdata, lfpdata, axis=0, time_axis=None, taper_axis=None, timepts=None, width=0.5, spacing=None, lims=None, timewins=None, data_type=None, spec_method='wavelet', smp_rate=None, return_phase=False, keepdims=True, **kwargs)¶
Alias of
spike_field_plv()
. See there for details.
- spike_field_ppc(spkdata, lfpdata, axis=0, time_axis=None, taper_axis=None, timepts=None, width=0.5, spacing=None, lims=None, timewins=None, data_type=None, spec_method='wavelet', smp_rate=None, return_phase=False, keepdims=True, **kwargs)¶
Compute pairwise phase consistency (PPC) of spike-triggered LFP phase, which is bias-corrected (unlike PLV and coherence, which are biased by n)
PPC is an debiased estimator of PLV^2, and can be expressed (and computed efficiently) in terms of PLV and n:
PPC = (n*PLV^2 - 1) / (n-1)
Because spiking response are sparse, spike-LFP PPC is typically computed within sliding time windows (ie summation across trials AND across within-window timepoints). These can be specified either explicitly using timewins or implicitly using width/spacing/lims.
Only parameters differing from
spike_field_coupling()
are described here.- Parameters:
width (scalar, default: 0.5 (500 ms)) – Width (in s) of sliding time windows for computing PPC
spacing (scalar, default: set = width (ie exactly non-overlapping windows)) – Spacing (in s) of sliding time windows for computing PPC
lims (array-like, shape=(2,), default: (timepts[0],timepts[-1]) (full sampled time of data)) – [Start,end] time limits (in s) for full series of sliding windows
timewins (ndarray, shape=(n_timewins,2), default: setup_sliding_windows(width,lims,spacing)) –
Alternative method for setting sliding time windows; overrides width/spacing/lims. Custom time windows to compute PPC within, given as explicit series of window [start,end]’s (in s). Can have any arbitrary width/spacing (eg to compute PPC in arbitary time epochs). Default generates sliding windows with width and spacing from lims[0] to lims[1]
Special case: Set = (lim[0],lim[1]) to compute PPC spectrum over entire data time period.
**kwargs – Any other keyword args passed as-is to spectrogram() function.
References
Original concept: Vinck et al. (2010) https://doi.org/10.1016/j.neuroimage.2010.01.073
Relation to PLV: Kornblith, Buschman, Miller (2015) https://doi.org/10.1093/cercor/bhv182
- spike_field_pairwise_phase_consistency(spkdata, lfpdata, axis=0, time_axis=None, taper_axis=None, timepts=None, width=0.5, spacing=None, lims=None, timewins=None, data_type=None, spec_method='wavelet', smp_rate=None, return_phase=False, keepdims=True, **kwargs)¶
Alias of
spike_field_ppc()
. See there for details.
- plv_to_ppc(PLV, n)¶
Convert PLV to PPC as:
PPC = (n*PLV^2 - 1)/(n-1)