meegsim.coupling.ppc_constant_phase_shift#

meegsim.coupling.ppc_constant_phase_shift(waveform, sfreq, phase_lag, fmin=None, fmax=None, 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 constant phase lag.

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 of the signal, in Hz.

phase_lagfloat

Constant phase lag to apply to the waveform in radians.

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.

fminfloat, optional

Lower cutoff frequency for the oscillation that gives rise to the random amplitude envelope (only if the envelope is set to "random").

fmaxfloat, optional

Upper cutoff frequency for the oscillation that gives rise to the random amplitude envelope (only if the envelope is set to "random").

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, optional

Random state can be fixed to provide reproducible results if the envelope is generated randomly. If not set, the results may differ between function calls.

Returns:
outarray, shape (n_times,)

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