gaitmap.utils.signal_processing.row_wise_autocorrelation#

gaitmap.utils.signal_processing.row_wise_autocorrelation(array: ndarray, lag_max: int)[source]#

Compute the autocorrelation function row-wise for a 2d array.

Parameters:
arrayarray with shape (n,m)

array which holds in every row a signal (window) for which the autocorrelation function should be computed

lag_maxint

the maximum lag for which the autocorrelation function should be computed. This relates to the lower frequency bound that is required.

Returns:
A 2d array that holds the autocorrelation function for each row in the input array

Examples

>>> t = np.arange(0, 1, 0.1)
>>> sin_wave = np.sin(t)
>>> array = np.array([sin_wave, sin_wave])
>>> out = row_wise_autocorrelation(array, 5)
>>> out
np.array([[2.38030226, 2.03883723, 1.68696752, 1.33807603, 1.00531772, 0.70139157],
   [2.38030226, 2.03883723, 1.68696752, 1.33807603, 1.00531772, 0.70139157]])