fooof.sim.params.param_sampler

fooof.sim.params.param_sampler(params, probs=None)[source]

Create a generator to sample randomly from possible parameters.

Parameters
paramslist of lists or list of float

Possible parameter values.

probslist of float, optional

Probabilities with which to sample each parameter option. If None, each parameter option is sampled uniformly.

Yields
list of float

A randomly sampled set of parameters.

Examples

Sample from aperiodic definitions with high and low exponents, with 50% probability of each:

>>> aps = param_sampler([[1, 1], [2, 1]], probs=[0.5, 0.5])

Sample from peak definitions of alpha or alpha & beta, with 75% change of sampling just alpha:

>>> peaks = param_sampler([[10, 1, 1], [[10, 1, 1], [20, 0.5, 1]]], probs=[0.75, 0.25])