def test_e_BuildMSM(self): Assignments = io.loadh("Data/Assignments.h5", 'arr_0') BuildMSM.run(Lagtime, Assignments, Symmetrize="MLE") # Test mapping m = np.loadtxt("Data/Mapping.dat") r_m = np.loadtxt(ReferenceDir + "/Data/Mapping.dat") npt.assert_array_almost_equal(m, r_m, err_msg="Mapping.dat incorrect") # Test populations p = np.loadtxt("Data/Populations.dat") r_p = np.loadtxt(ReferenceDir + "/Data/Populations.dat") npt.assert_array_almost_equal(p, r_p, err_msg="Populations.dat incorrect") # Test counts matrix C = scipy.io.mmread("Data/tCounts.mtx") r_C = scipy.io.mmread(ReferenceDir + "/Data/tCounts.mtx") D = (C - r_C).data Z = 0. * D D /= r_C.sum( ) #KAB 4-5-2012. We want the normalized counts to agree at 7 decimals #normalizing makes this test no longer depend on an arbitrary scaling factor (the total number of counts) #the relative number of counts in the current and reference models DOES matter, however. npt.assert_array_almost_equal(D, Z, err_msg="tCounts.mtx incorrect") # Test transition matrix T = scipy.io.mmread("Data/tProb.mtx") r_T = scipy.io.mmread(ReferenceDir + "/Data/tProb.mtx") D = (T - r_T).data Z = 0. * D npt.assert_array_almost_equal(D, Z, err_msg="tProb.mtx incorrect")
def test_e_BuildMSM(self): Assignments = io.loadh("Data/Assignments.h5", 'arr_0') BuildMSM.run(Lagtime, Assignments, Symmetrize="MLE") # Test mapping m = np.loadtxt("Data/Mapping.dat") r_m = np.loadtxt(ReferenceDir +"/Data/Mapping.dat") npt.assert_array_almost_equal(m, r_m, err_msg="Mapping.dat incorrect") # Test populations p = np.loadtxt("Data/Populations.dat") r_p = np.loadtxt(ReferenceDir +"/Data/Populations.dat") npt.assert_array_almost_equal(p, r_p, err_msg="Populations.dat incorrect") # Test counts matrix C = scipy.io.mmread("Data/tCounts.mtx") r_C = scipy.io.mmread(ReferenceDir +"/Data/tCounts.mtx") D=(C-r_C).data Z=0.*D D /= r_C.sum()#KAB 4-5-2012. We want the normalized counts to agree at 7 decimals #normalizing makes this test no longer depend on an arbitrary scaling factor (the total number of counts) #the relative number of counts in the current and reference models DOES matter, however. npt.assert_array_almost_equal(D,Z, err_msg="tCounts.mtx incorrect") # Test transition matrix T = scipy.io.mmread("Data/tProb.mtx") r_T = scipy.io.mmread(ReferenceDir +"/Data/tProb.mtx") D=(T-r_T).data Z=0.*D npt.assert_array_almost_equal(D,Z, err_msg="tProb.mtx incorrect")
def test(self): BuildMSM.run(lagtime=1, assignments=get('Assignments.h5')['arr_0'], symmetrize='MLE', out_dir=self.td) eq(load(pjoin(self.td, 'tProb.mtx')), get('tProb.mtx'), decimal=5) eq(load(pjoin(self.td, 'tCounts.mtx')), get('tCounts.mtx'), decimal=3) eq(load(pjoin(self.td, 'Mapping.dat')), get('Mapping.dat')) eq(load(pjoin(self.td, 'Assignments.Fixed.h5')), get('Assignments.Fixed.h5')) eq(load(pjoin(self.td, 'Populations.dat')), get('Populations.dat'))
def test(self): BuildMSM.run(LagTime=1, assignments=get('Assignments.h5')['arr_0'], Symmetrize='MLE', OutDir=self.td) eq(load(pjoin(self.td, 'tProb.mtx')), get('tProb.mtx')) eq(load(pjoin(self.td, 'tCounts.mtx')), get('tCounts.mtx')) eq(load(pjoin(self.td, 'Mapping.dat')), get('Mapping.dat')) eq(load(pjoin(self.td, 'Assignments.Fixed.h5')), get('Assignments.Fixed.h5')) eq(load(pjoin(self.td, 'Populations.dat')), get('Populations.dat'))