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:
- waveform
array The input signal to be processed. It can be a real or complex time series.
- sfreq
float Sampling frequency of the signal, in Hz.
- phase_lag
float Constant phase lag to apply to the waveform in radians.
- envelope
str, {“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.
- fmin
float, optional Lower cutoff frequency for the oscillation that gives rise to the random amplitude envelope (only if the
envelopeis set to"random").- fmax
float, optional Upper cutoff frequency for the oscillation that gives rise to the random amplitude envelope (only if the
envelopeis set to"random").- m
float, optional Multiplier for the base frequency of the output oscillation, default is 1.
- n
float, optional Multiplier for the base frequency of the input oscillation, default is 1.
- random_state
None, 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.
- waveform
- Returns:
- out
array, shape (n_times,) The phase-coupled waveform with the same amplitude envelope as the input one.
- out