specparam.sim.sim_spectrogram

specparam.sim.sim_spectrogram(n_windows, freq_range, aperiodic_params, periodic_params, nlvs=0.005, freq_res=0.5, f_rotation=None, return_params=False)[source]

Simulate spectrogram.

Parameters:
n_windowsint

The number of time windows to generate.

freq_rangelist of [float, float]

Frequency range to simulate power spectra across, as [f_low, f_high], inclusive.

aperiodic_paramsdict of {strarray}

Mode definition and parameters to create the aperiodic components of the power spectra. Should be organized as {mode : params}, where mode is a string label for a mode to simulate with and params (array_like or generator) defines the aperiodic parameters.

periodic_paramsdict of {strlist of float or list of list of float}

Mode definition and parameters to create the periodic components of the power spectras. Should be organized as {mode : params}, where mode is a string label for a mode to simulate with and params (array_like or generator) defines the periodic parameters.

nlvsfloat or list of float or generator, optional, default: 0.005

Noise level to add to generated power spectrum.

freq_resfloat, optional, default: 0.5

Frequency resolution for the simulated power spectra.

f_rotationfloat, optional

Frequency value, in Hz, to rotate around. Should only be set if spectrum is to be rotated. Can only be used with powerlaw aperiodic mode. See additional notes in sim_power_spectra on rotating simulated power spectra.

return_paramsbool, optional, default: False

Whether to return the parameters for the simulated spectra.

Returns:
freqs1d array

Frequency values, in linear spacing.

spectrogram2d array

Matrix of power values, in linear spacing, as [n_freqs, n_windows].

sim_paramslist of SimParams

Definitions of parameters used for each spectrum. Has length of n_spectra. Only returned if return_params is True.

Notes

This function simulates spectra for the spectrogram using sim_group_power_spectra. See sim_group_power_spectra for details on the parameters.

Examples using specparam.sim.sim_spectrogram

09: Fitting Models over Time

09: Fitting Models over Time