phase_diffusion#
- syncopy.synthdata.phase_diffusion(freq, eps=0.1, samplerate=1000, nChannels=2, nSamples=1000, rand_ini=False, return_phase=False, seed=None, nTrials=100)[source]#
Linear (harmonic) phase evolution plus a Brownian noise term inducing phase diffusion around the deterministic phase velocity (angular frequency).
The linear phase increments are given by
\[\Delta \phi = 2\pi \frac{freq}{samplerate}\]The Brownian increments are scaled with eps relative to these phase increments, meaning the relative phase diffusion is frequency independent.
- Parameters:
freq (float) – Harmonic frequency in Hz
eps (float) – Scaled Brownian increments 1 means the single Wiener step has on average the size of the harmonic increments
samplerate (float) – Sampling rate in Hz
nChannels (int) – Number of channels
nSamples (int) – Number of samples in time
rand_ini (bool, optional) – If set to
True
initial phases are randomizedreturn_phase (bool, optional) – If set to true returns the phases in radians
seed (None or int) – Set to an int to get reproducible results, or None for random ones.
nTrials (int or None) – Number of trials for the returned
AnalogData
object. When set to None a single-trialndarray
is returned.
- Returns:
phases – Synthetic nSamples x nChannels data array simulating noisy phase evolution/diffusion
- Return type:
syncopy.AnalogData
or numpy.ndarray
Examples
Weak phase diffusion around the 60Hz harmonic:
>>> signals = spy.synthdata.phase_diffusion(freq=60, eps=0.01)
Return the unwrapped phase directly:
>>> phases = spy.synthdata.phase_diffusion(freq=60, eps=0.01, return_phase=True)