def test_generate_trajectory(oom_msm_scenario): for msm in oom_msm_scenario.msms: dtrajs_proj = msm.count_model.transform_discrete_trajectories_to_submodel(oom_msm_scenario.dtrajs) indices = compute_index_states(dtrajs_proj) traj = msm.simulate(10) ix = indices_by_sequence(indices, traj) np.testing.assert_equal(ix.shape, (10, 2))
def test_sample_by_sequence(self): dtraj = [0, 1, 2, 3, 2, 1, 0] idx = sample.compute_index_states(dtraj) seq = [0, 1, 1, 1, 0, 0, 0, 0, 1, 1] sidx = sample.indices_by_sequence(idx, seq) assert (np.alltrue(sidx.shape == (len(seq), 2))) for t in range(sidx.shape[0]): assert (sidx[t, 0] == 0) # did we pick the right traj? assert (dtraj[sidx[t, 1]] == seq[t]) # did we pick the right states?