def test_count_3(self):
     S1 = np.array([0, 1, 2, 3, 4])
     S2 = np.array([2, 2, 2, 2, 6])
     H = np.array([1, 1, 5, 1, 1, 0, 1])
     assert (dt.number_of_states([S1, S2]) == 7)
     assert (dt.number_of_states([S1, S2], only_used=True) == 6)
     assert (np.allclose(dt.count_states([S1, S2]), H))
Пример #2
0
    def active_count_fraction(self):
        """The fraction of counts in the largest connected set.

        """
        self._check_is_estimated()
        from pyerna.util.discrete_trajectories import count_states

        hist = count_states(self._dtrajs_full)
        hist_active = hist[self.active_set]
        return float(_np.sum(hist_active)) / float(_np.sum(hist))
Пример #3
0
    def _active_state_indexes(self, msm):
        I = msm.active_state_indexes
        assert (len(I) == msm.nstates)
        # compare to histogram
        import pyerna.util.discrete_trajectories as dt

        hist = dt.count_states(msm.discrete_trajectories_full)
        # number of frames should match on active subset
        A = msm.active_set
        for i in range(A.shape[0]):
            assert (I[i].shape[0] == hist[A[i]])
            assert (I[i].shape[1] == 2)
Пример #4
0
    def test_observable_state_indexes(self):
        hmsm = self.hmsm_lag10
        I = hmsm.observable_state_indexes
        assert (len(I) == hmsm.nstates_obs)
        # compare to histogram
        import pyerna.util.discrete_trajectories as dt

        hist = dt.count_states(hmsm.discrete_trajectories_full)
        # number of frames should match on active subset
        A = hmsm.observable_set
        for i in range(A.shape[0]):
            assert (I[i].shape[0] == hist[A[i]])
            assert (I[i].shape[1] == 2)
 def test_count_2(self):
     S = np.array([1, 1, 1, 1, 1, 1])
     H = np.array([0, 6])
     assert (dt.number_of_states(S) == 2)
     assert (dt.number_of_states(S, only_used=True) == 1)
     assert (np.allclose(dt.count_states(S), H))
 def test_count_big(self):
     import pyerna.datasets
     dtraj = pyerna.datasets.load_2well_discrete().dtraj_T100K_dt10
     dt.number_of_states(dtraj)
     dt.count_states(dtraj)