neurodsp.aperiodic.autocorr.compute_autocorr¶
- neurodsp.aperiodic.autocorr.compute_autocorr(sig, max_lag=1000, lag_step=1, demean=True)[source]¶
Compute the signal autocorrelation (lagged correlation).
- Parameters
- sigarray 1D
Time series to compute autocorrelation over.
- max_lagint, optional, default: 1000
Maximum delay to compute autocorrelations for, in samples.
- lag_stepint, optional, default: 1
Step size (lag advance) for computing autocorrelations.
- demeanbool, optional, default: True
Whether to demean the signal before computing autocorrelations.
- Returns
- timepoints1d array
Time points, in samples, at which autocorrelations are computed.
- autocorrs1d array
Autocorrelation values, for across time lags.
Examples
Compute the autocorrelation of a simulated pink noise signal:
>>> from neurodsp.sim import sim_powerlaw >>> sig = sim_powerlaw(n_seconds=10, fs=500, exponent=-1) >>> timepoints, autocorrs = compute_autocorr(sig)