def auto_correlation_time(x, s, mu, var): b, t, d = x.shape act_ = np.zeros([d]) for i in range(0, b): y = x[i] - mu p, n = y[:-s], y[s:] act_ += np.mean(p * n, axis=0) / var act_ = act_ / b return act_