meegsim.coupling.ppc_von_mises#

meegsim.coupling.ppc_von_mises(waveform, sfreq, phase_lag, kappa, fmin, fmax, envelope='random', m=1, n=1, random_state=None)[source]#

Generate a time series that is phase coupled to the input time series with a probabilistic phase lag based on the von Mises distribution.

This function can be used to set up both within-frequency (1:1, default) and cross-frequency (n:m) coupling.

Note

This function is using Hilbert transform for manipulating the phase of the time series, so the result might not be meaningful if applied to broadband data.

Parameters:
waveformarray

The input signal to be processed. It can be a real or complex time series.

sfreqfloat

Sampling frequency (in Hz).

phase_lagfloat

Average phase lag to apply to the waveform in radians.

kappafloat

Concentration parameter of the von Mises distribution. With higher kappa, phase shifts between input and output waveforms are more concentrated around the mean value provided in phase_lag. With lower kappa, phase shifts will vary substantially for different time points.

fmin: float

Lower cutoff frequency of the base frequency harmonic (in Hz).

fmax: float

Upper cutoff frequency of the base frequency harmonic (in Hz).

envelopestr, {“same”, “random”}

Controls the amplitude envelope of the coupled waveform to be either randomly generated (default) or to be the same as the envelope of the input waveform.

mfloat, optional

Multiplier for the base frequency of the output oscillation, default is 1.

nfloat, optional

Multiplier for the base frequency of the input oscillation, default is 1.

random_stateNone (default) or int

Seed for the random number generator. If None (default), results will vary between function calls. Use a fixed value for reproducibility.

Returns:
outarray, shape (n_times,)

The phase-coupled waveform with the same amplitude envelope as the input one.

Examples using meegsim.coupling.ppc_von_mises#

Minimal example

Minimal example

Phase-phase coupling based on von Mises distribution

Phase-phase coupling based on von Mises distribution