pyrasa.utils.fit_funcs.KneeFitFun#

class pyrasa.utils.fit_funcs.KneeFitFun(freq: ndarray, aperiodic_spectrum: ndarray, scale_factor: int | float)[source]#

A model for fitting aperiodic activity in power spectra with a spectral knee.

The KneeFitFun class extends AbstractFitFun to model aperiodic activity in power spectra using a function that includes a spectral knee. This model is particularly useful for cases where the aperiodic component of the spectrum has a break or knee, representing a transition between two different spectral slopes.

label#

A label to identify this fitting model. Default is ‘knee’.

Type:

str

log10_aperiodic#

Indicates whether to log-transform the aperiodic spectrum. Default is True.

Type:

bool

func(x: np.ndarray, Offset: float, Knee: float, Exponent_1: float, Exponent_2: float) np.ndarray[source]#

Defines the model function for aperiodic activity with a spectral knee and pre-knee slope.

add_infos_to_df(df_params: pd.DataFrame) pd.DataFrame[source]#

Adds calculated knee frequency to the DataFrame of fit parameters.

curve_kwargs() dict[str, Any]#

Generates initial guess parameters and other keyword arguments for curve fitting.

Attributes:
aperiodic_spectrum
curve_kwargs
freq
scale_factor

Methods

func(x, Offset, Knee, Exponent_1, Exponent_2)

Model aperiodic activity with a spectral knee and a pre-knee slope.

add_infos_to_df

fit_func

handle_scaling

__hash__ = None#
func(x: ndarray, Offset: float, Knee: float, Exponent_1: float, Exponent_2: float) ndarray[source]#

Model aperiodic activity with a spectral knee and a pre-knee slope. Use this to model aperiodic activity with a spectral knee