1919import unittest
2020import numpy as np
2121from deeptime .markov .tools .analysis import is_transition_matrix , is_reversible
22+ from numpy .testing import assert_allclose
2223
2324from pyemma .msm import bayesian_hidden_markov_model
2425
@@ -29,7 +30,7 @@ class TestBHMM(unittest.TestCase):
2930 def setUpClass (cls ):
3031 # load observations
3132 import pyemma .datasets
32- obs = pyemma .datasets .load_2well_discrete ().dtraj_T100K_dt10
33+ obs = pyemma .datasets .load_2well_discrete ().dtraj
3334
3435 # hidden states
3536 cls .nstates = 2
@@ -331,9 +332,9 @@ def test_separate_states(self):
331332 np .array ([2 , 2 , 2 , 2 , 2 , 2 , 1 , 1 , 1 , 1 , 1 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 2 ]),]
332333 hmm_bayes = bayesian_hidden_markov_model (dtrajs , 3 , lag = 1 , separate = [0 ], nsamples = 100 , store_hidden = True )
333334 # we expect zeros in all samples at the following indexes:
334- pobs_zeros = [[ 0 , 1 , 2 , 2 , 2 ], [ 0 , 0 , 1 , 2 , 3 ]]
335- for s in hmm_bayes .samples :
336- assert np . allclose (s .observation_probabilities [pobs_zeros ], 0 )
335+ pobs_zeros = (( 0 , 1 , 2 , 2 , 2 ), ( 0 , 0 , 1 , 2 , 3 ))
336+ for i , s in enumerate ( hmm_bayes .samples ) :
337+ assert_allclose (s .observation_probabilities [pobs_zeros ], 0 , err_msg = f" { i } " )
337338 for strajs in hmm_bayes .sampled_trajs :
338339 assert strajs [0 ][0 ] == 2
339340 assert strajs [0 ][6 ] == 2
@@ -342,7 +343,7 @@ def test_initialized_bhmm(self):
342343 import pyemma .datasets as d
343344 import pyemma .msm
344345
345- obs = d .load_2well_discrete ().dtraj_T100K_dt10
346+ obs = d .load_2well_discrete ().dtraj
346347
347348 init_hmm = pyemma .msm .estimate_hidden_markov_model (obs , 2 , 10 )
348349 bay_hmm = pyemma .msm .estimators .BayesianHMSM (nstates = init_hmm .nstates , lag = init_hmm .lag ,
0 commit comments