Esempio n. 1
0
 def test_its_estimated_with_only_ts(self):
     its = ImpliedTimescales(estimator=self.estimator,
                             lags=[1, 2, 3],
                             only_timescales=True,
                             n_jobs=1)
     its.estimate(self.dtraj)
     plot_implied_timescales(its)
Esempio n. 2
0
 def test_its_estimated_with_only_ts_samples(self):
     from pyemma.msm import BayesianMSM
     its = ImpliedTimescales(estimator=BayesianMSM(nsamples=2),
                             lags=[1, 2, 3],
                             only_timescales=True)
     its.estimate(self.dtraj)
     plot_implied_timescales(its)
Esempio n. 3
0
 def test_2(self):
     t2 = timescales(self.P2)[1]
     lags = [1, 2, 3, 4, 5]
     its = ImpliedTimescales([self.dtraj2], lags=lags)
     est = its.timescales[0]
     assert (np.alltrue(est < t2 + 2.0))
     assert (np.alltrue(est > t2 - 2.0))
Esempio n. 4
0
 def test_4_2(self):
     t4 = timescales(self.P4)[1]
     lags = [int(t4)]
     its = ImpliedTimescales([self.dtraj4_2], lags=lags)
     est = its.timescales[0]
     assert (np.alltrue(est < t4 + 20.0))
     assert (np.alltrue(est > t4 - 20.0))
Esempio n. 5
0
    def compute_nice(self, reversible):
        """
        Tests if standard its estimates run without errors

        :return:
        """
        for i in range(len(self.dtrajs)):
            its = ImpliedTimescales(self.dtrajs[i], reversible=reversible)
Esempio n. 6
0
 def test_too_large_lagtime(self):
     dtraj = [[0, 1, 1, 1, 0]]
     lags = [1, 2, 3, 4, 5, 6, 7, 8]
     expected_lags = [
         1, 2, 3
     ]  # 4 is impossible because only one state remains and no finite timescales.
     with warnings.catch_warnings(record=True) as w:
         warnings.simplefilter("always")
         its = ImpliedTimescales(dtraj, lags=lags, reversible=False)
         assert issubclass(w[-1].category, UserWarning)
     got_lags = its.lagtimes
     assert (np.shape(got_lags) == np.shape(expected_lags))
     assert (np.allclose(got_lags, expected_lags))
Esempio n. 7
0
    def setUpClass(cls):
        P = np.array([[0.5, .25, .25, 0.],
                      [0., .25, .5, .25],
                      [.25, .25, .5, 0],
                      [.25, .25, .25, .25],
                      ])
        # bogus its object
        lags = [1, 2, 3, 5, 10]
        dtraj = generate_traj(P, 1000)
        estimator = MaximumLikelihoodMSM(dt_traj='10 ps')
        cls.its = ImpliedTimescales(estimator=estimator)
        cls.its.estimate(dtraj, lags=lags)

        cls.refs = cls.its.timescales[-1]
        return cls
Esempio n. 8
0
    def setUpClass(cls):
        P = np.array([
            [0.5, .25, .25, 0.],
            [0., .25, .5, .25],
            [.25, .25, .5, 0],
            [.25, .25, .25, .25],
        ])
        # bogus its object
        lags = [1, 2, 3, 5, 10]
        cls.dtraj = MarkovStateModel(P).simulate(1000)
        cls.estimator = MaximumLikelihoodMSM(dt_traj='10 ps')
        cls.its = ImpliedTimescales(estimator=cls.estimator, n_jobs=1)
        cls.its.estimate(cls.dtraj, lags=lags)

        cls.refs = cls.its.timescales[-1]
        return cls