def test_fingerprint_relaxation(self):
     one_vec = np.ones(self.T.shape[0])
     """k=None"""
     relax_amp = np.dot(self.p0, self.R) * np.dot(self.L, self.obs1)
     tsn, relax_ampn = fingerprint_relaxation(self.T, self.p0, self.obs1)
     assert_allclose(tsn, self.ts)
     assert_allclose(relax_ampn, relax_amp)
     """k=4"""
     k = self.k
     relax_amp = np.dot(self.p0, self.R[:, 0:k]) * np.dot(
         self.L[0:k, :], self.obs1)
     tsn, relax_ampn = fingerprint_relaxation(self.T,
                                              self.p0,
                                              self.obs1,
                                              k=k)
     assert_allclose(tsn, self.ts[0:k])
     assert_allclose(relax_ampn, relax_amp)
    def test_fingerprint_relaxation(self):
        one_vec = np.ones(self.T.shape[0])

        relax_amp = np.dot(self.p0, self.R) * np.dot(self.L, self.obs1)
        tsn, relax_ampn = fingerprint_relaxation(self.T,
                                                 self.p0,
                                                 self.obs1,
                                                 k=self.k)
        assert_allclose(tsn, self.ts)
        assert_allclose(relax_ampn, relax_amp)
Exemple #3
0
def test_fingerprint_relaxation(fingerprints_data, observables):
    obs1, obs2 = observables
    T = fingerprints_data.transition_matrix
    ts = timescales(T, k=4 if fingerprints_data.sparse else None)
    R, D, L = rdl_decomposition(T, k=4 if fingerprints_data.sparse else None)
    """Initial vector for relaxation"""
    p0 = np.zeros(10)
    p0[0:4] = 0.25
    if not fingerprints_data.sparse:
        """k=None"""
        relax_amp = np.dot(p0, R) * np.dot(L, obs1)
        tsn, relax_ampn = fingerprint_relaxation(T, p0, obs1)
        assert_allclose(tsn, ts)
        assert_allclose(relax_ampn, relax_amp)
    """k=4"""
    k = 4
    relax_amp = np.dot(p0, R[:, 0:k]) * np.dot(L[0:k, :], obs1)
    tsn, relax_ampn = fingerprint_relaxation(T, p0, obs1, k=k)
    assert_allclose(tsn, ts[0:k])
    assert_allclose(relax_ampn, relax_amp)