specparam.fit_models_3d

specparam.fit_models_3d(group, freqs, power_spectra, freq_range=None, n_jobs=1)[source]

Fit power spectrum models across a 3d array of power spectra.

Parameters:
groupSpectralGroupModel

Object to fit with, initialized with desired settings.

freqs1d array

Frequency values for the power spectra, in linear space.

power_spectra3d array

Power values, in linear space, with shape as: [n_conditions, n_power_spectra, n_freqs].

freq_rangelist of [float, float], optional

Frequency range to fit. If not provided, fits the entire given range.

n_jobsint, optional, default: 1

Number of jobs to run in parallel. 1 is no parallelization. -1 uses all available cores.

Returns:
all_modelslist of SpectralGroupModel

Collected model results after fitting across power spectra, length of n_conditions.

Examples

Fit a 3d array of power spectra, assuming freqs and spectra are already defined:

>>> from specparam import SpectralGroupModel
>>> group = SpectralGroupModel(peak_width_limits=[1, 6], min_peak_height=0.1)
>>> models = fit_models_3d(group, freqs, power_spectra, freq_range=[3, 30])  

Examples using specparam.fit_models_3d

Fitting Power Spectrum Models Across 3D Arrays

Fitting Power Spectrum Models Across 3D Arrays