def test_correlation(self): """Auto-correlation""" acorr_amp = np.dot(self.mu * self.obs1, self.R) * np.dot( self.L, self.obs1) acorr = np.dot(self.ev_t, acorr_amp) acorrn = correlation(self.T, self.obs1, k=self.k, times=self.times) assert_allclose(acorrn, acorr) """Cross-correlation""" corr_amp = np.dot(self.mu * self.obs1, self.R) * np.dot( self.L, self.obs2) corr = np.dot(self.ev_t, corr_amp) corrn = correlation(self.T, self.obs1, obs2=self.obs2, k=self.k, times=self.times) assert_allclose(corrn, corr)
def test_correlation(self): """Auto-correlation""" """k=None""" acorr_amp = np.dot(self.mu * self.obs1, self.R) * np.dot( self.L, self.obs1) acorr = np.dot(self.ev_t, acorr_amp) acorrn = correlation(self.T, self.obs1, times=self.times) assert_allclose(acorrn, acorr) """k=4""" k = self.k acorr_amp = np.dot(self.mu * self.obs1, self.R[:, 0:k]) * np.dot( self.L[0:k, :], self.obs1) acorr = np.dot(self.ev_t[:, 0:k], acorr_amp) acorrn = correlation(self.T, self.obs1, times=self.times, k=k) assert_allclose(acorrn, acorr) """Cross-correlation""" """k=None""" corr_amp = np.dot(self.mu * self.obs1, self.R) * np.dot( self.L, self.obs2) corr = np.dot(self.ev_t, corr_amp) corrn = correlation(self.T, self.obs1, obs2=self.obs2, times=self.times) assert_allclose(corrn, corr) """k=4""" k = self.k corr_amp = np.dot(self.mu * self.obs1, self.R[:, 0:k]) * np.dot( self.L[0:k, :], self.obs2) corr = np.dot(self.ev_t[:, 0:k], corr_amp) corrn = correlation(self.T, self.obs1, obs2=self.obs2, times=self.times, k=k) assert_allclose(corrn, corr)
def test_correlation(fingerprints_data, observables): obs1, obs2 = observables T = fingerprints_data.transition_matrix R, D, L = rdl_decomposition(T, k=4 if fingerprints_data.sparse else None) mu = fingerprints_data.stationary_distribution times = np.array([1, 5, 10, 20, 100]) ev = np.diagonal(D) ev_t = ev[np.newaxis, :]**times[:, np.newaxis] if not fingerprints_data.sparse: """k=None""" acorr_amp = np.dot(mu * obs1, R) * np.dot(L, obs1) acorr = np.dot(ev_t, acorr_amp) acorrn = correlation(T, obs1, times=times) assert_allclose(acorrn, acorr) """k=4""" k = 4 acorr_amp = np.dot(mu * obs1, R[:, 0:k]) * np.dot(L[0:k, :], obs1) acorr = np.dot(ev_t[:, 0:k], acorr_amp) acorrn = correlation(T, obs1, times=times, k=k) assert_allclose(acorrn, acorr) """Cross-correlation""" if not fingerprints_data.sparse: """k=None""" corr_amp = np.dot(mu * obs1, R) * np.dot(L, obs2) corr = np.dot(ev_t, corr_amp) corrn = correlation(T, obs1, obs2=obs2, times=times) assert_allclose(corrn, corr) """k=4""" k = k corr_amp = np.dot(mu * obs1, R[:, 0:k]) * np.dot(L[0:k, :], obs2) corr = np.dot(ev_t[:, 0:k], corr_amp) corrn = correlation(T, obs1, obs2=obs2, times=times, k=k) assert_allclose(corrn, corr)