collect_trials#

syncopy.synthdata.collect_trials(trial_func)[source]#

Decorator to wrap around a single trial (nSamples x nChannels shaped np.ndarray) synthetic data function. Creates a generator expression to arrive memory safely at a multi-trial :class:~syncopy.AnalogData object.

All single trial producing functions (the trial_func) should accept nChannels and nSamples as keyword arguments, OR provide other means to define those numbers, e.g. AdjMat for ar2_network()

If the single trial function also accepts a samplerate parameter, forward it directly.

If the underlying trial generating function also accepts a seed, forward this directly. One can set seed_per_trial=False to use the same seed for all trials, or leave seed_per_trial=True (the default), to have this function internally generate a list of seeds with len equal to nTrials from the given seed, with one seed per trial.

One can set the seed to None, which will select a random seed each time, (and it will differ between trials).

The default nTrials=None is the identity wrapper and just returns the output of the trial generating function directly, so a single trial numpy.ndarray.