neurodsp.sim.multi.sim_from_sampler

neurodsp.sim.multi.sim_from_sampler(function, sampler, n_sims)[source]

Simulate a set of signals from a parameter sampler.

Parameters:
functionstr or callable

Function to create the simulated time series. If string, should be the name of the desired simulation function.

samplerParamSampler

Parameter definition to sample from.

n_simsint

Number of simulations to create per parameter definition.

Returns:
simsVariableSimulations

Simulations object with simulated time series and metadata. Simulated signals are in the ‘signals’ attribute with shape [n_sims, sig_length].

Examples

Simulate multiple powerlaw signals using a parameter sampler:

>>> from neurodsp.sim.aperiodic import sim_powerlaw
>>> from neurodsp.sim.update import create_updater, create_sampler, ParamSampler
>>> params = {'n_seconds' : 10, 'fs' : 250, 'exponent' : None}
>>> samplers = {create_updater('exponent') : create_sampler([-2, -1, 0])}
>>> param_sampler = ParamSampler(params, samplers)
>>> sims = sim_from_sampler(sim_powerlaw, param_sampler, n_sims=2)