pyhctsa.operations.correlation.autocorr_shape

pyhctsa.operations.correlation.autocorr_shape(y, stop_when='pos_drown')

How the autocorrelation function changes with the time lag.

Outputs include the number of peaks, and autocorrelation in the autocorrelation function (ACF) itself.

Parameters:
y : array-like

The input time series.

stop_when : str or int, optional

The criterion for the maximum lag to measure the ACF up to. Default is 'pos_drown'.

  • 'pos_drown': the initial positive stretch, up to the first value below the threshold 2/sqrt(N) (or just before the ACF turns negative).

  • 'drown': up to the first lag at which the ACF is within 2/sqrt(N) of zero.

  • 'double_drown': up to lag 2*m, where m is the most recent lag at which the ACF is within 2/sqrt(N) of zero (m is updated at every such lag, so the ACF is cut at the first lag equal to twice the most recent such lag). All lags are used if that point is not reached.

  • an int: the maximum lag.

Returns:

A dictionary containing various metrics about the autocorrelation function. Nac is the number of points of the initial positive stretch for 'pos_drown' (0 if the ACF never drops below the threshold). For 'drown' it is the first lag within the threshold band of zero, for 'double_drown' the most recent such lag, and for an int that value.

Return type:

dict