neurodsp.sim.sim_bursty_oscillation

neurodsp.sim.sim_bursty_oscillation(n_seconds, fs, freq, enter_burst=0.2, leave_burst=0.2, cycle='sine', **cycle_params)[source]

Simulate a bursty oscillation.

Parameters
n_secondsfloat

Simulation time, in seconds.

fsfloat

Sampling rate of simulated signal, in Hz.

freqfloat

Oscillation frequency, in Hz.

enter_burstfloat, optional, default: 0.2

Probability of a cycle being oscillating given the last cycle is not oscillating.

leave_burstfloat, optional, default: 0.2

Probability of a cycle not being oscillating given the last cycle is oscillating.

cycle{‘sine’, ‘asine’, ‘sawtooth’, ‘gaussian’, ‘exp’, ‘2exp’}

What type of oscillation cycle to simulate. See sim_cycle for details on cycle types and parameters.

**cycle_params

Parameters for the simulated oscillation cycle.

Returns
sig1d array

Simulated bursty oscillation.

Notes

This function takes a ‘tiled’ approach to simulating cycles, with evenly spaced and consistent cycles across the whole signal, that are either oscillating or not.

If the cycle length does not fit evenly into the simulated data length, then the last few samples will be non-oscillating.

Examples

Simulate a bursty oscillation, with a low probability of bursting:

>>> sig = sim_bursty_oscillation(n_seconds=10, fs=500, freq=5, enter_burst=0.2, leave_burst=0.8)

Simulate a bursty oscillation, with a high probability of bursting:

>>> sig = sim_bursty_oscillation(n_seconds=10, fs=500, freq=5, enter_burst=0.8, leave_burst=0.4)

Simulate a bursty oscillation, of sawtooth waves:

>>> sig = sim_bursty_oscillation(n_seconds=10, fs=500, freq=10, cycle='sawtooth', width=0.3)

Examples using neurodsp.sim.sim_bursty_oscillation