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_paramslist of float or generator

Parameters for the aperiodic component of the power spectra.

periodic_paramslist of float or generator

Parameters for the periodic component of the power spectra. Length of n_peaks * 3.

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 spectra are to be rotated.

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

06: Fitting Models over Time

06: Fitting Models over Time