neurodsp.aperiodic.autocorr.fit_autocorr

neurodsp.aperiodic.autocorr.fit_autocorr(timepoints, autocorrs, fit_function='single_exp', bounds=None)[source]

Fit autocorrelation function, returning timescale estimate.

Parameters:
timepoints1d array

Timepoints for the computed autocorrelations, in samples or seconds.

autocorrs1d array

Autocorrelation values.

fsint, optional

Sampling rate of the signal. If provided, timepoints are converted to time values.

fit_func{‘single_exp’, ‘double_exp’}

Which fitting function to use to fit the autocorrelation results.

boundstuple of list

Parameter bounds for fitting. Organized as ([min_p1, min_p1, …], [max_p1, max_p2, …]).

Returns:
popts

Fit parameters. Parameters depend on the fitting function. If fit_func is ‘single_exp’, fit parameters are: tau, scale, offset If fit_func is ‘douple_exp’, fit parameters are: tau1, tau2, scale1, scale2, offset See fit function for more details.

Notes

The values / units of the returned parameters are dependent on the units of samples. For example, if the timepoints input is in samples, the fit tau value is too. If providing parameter bounds, these also need to match the unit of timepoints.