neurodsp.sim.combined.sim_combined

neurodsp.sim.combined.sim_combined(n_seconds, fs, components, component_variances=1)[source]

Simulate a signal by combining multiple component signals.

Parameters
n_secondsfloat

Simulation time, in seconds.

fsfloat

Signal sampling rate, in Hz.

componentsdictionary

A dictionary of simulation functions to run, with their desired parameters.

component_varianceslist of float or 1, optional, default: 1

Variance to simulate with for each component of the signal. If 1, each component signal is simulated with unit variance.

Returns
sig1d array

Simulated combined signal.

Examples

Simulate a combined signal with an aperiodic and periodic component:

>>> sim_components = {'sim_powerlaw': {'exponent' : -2}, 'sim_oscillation': {'freq' : 10}}
>>> sig = sim_combined(n_seconds=1, fs=500, components=sim_components)

Simulate a combined signal with multiple periodic components:

>>> sim_components = {'sim_powerlaw': {'exponent' : -2},
...                   'sim_oscillation': [{'freq' : 10}, {'freq' : 20}]}
>>> sig = sim_combined(n_seconds=1, fs=500, components=sim_components)

Simulate a combined signal with unequal variance for the different components:

>>> sig = sim_combined(n_seconds=1, fs=500,
...                    components={'sim_powerlaw': {}, 'sim_oscillation': {'freq' : 10}},
...                    component_variances=[0.25, 0.75])