def run(T, state): if state != -1: logger.info("Calculating MFPTs to state %d" % state) m = tpt.calculate_mfpt([state], T) logger.info("Finished calculating MFPTs to state %d" % state) else: logger.info("Calculating MFPTs to all states") m = tpt.calculate_all_to_all_mfpt(T) logger.info("Finished calculating MFPTs to all states") return m
def test_mfpt(self): mfpt = tpt.calculate_mfpt(self.sinks, self.tprob, lag_time=self.lag_time) mfpt_ref = io.loadh( tpt_get("mfpt.h5"), 'Data') npt.assert_array_almost_equal(mfpt, mfpt_ref) ensemble_mfpt = tpt.calculate_ensemble_mfpt(self.sources, self.sinks, self.tprob, self.lag_time) ensemble_mfpt_ref = io.loadh( tpt_get("ensemble_mfpt.h5"), 'Data') npt.assert_array_almost_equal(ensemble_mfpt, ensemble_mfpt_ref) all_to_all_mfpt = tpt.calculate_all_to_all_mfpt(self.tprob) all_to_all_mfpt_ref = io.loadh( tpt_get("all_to_all_mfpt.h5"), 'Data') npt.assert_array_almost_equal(all_to_all_mfpt, all_to_all_mfpt_ref)
def test_mfpt(self): mfpt = tpt.calculate_mfpt(self.sinks, self.tprob, lag_time=self.lag_time) mfpt_ref = io.loadh(os.path.join(self.tpt_ref_dir, "mfpt.h5"), 'Data') npt.assert_array_almost_equal(mfpt, mfpt_ref) ensemble_mfpt = tpt.calculate_ensemble_mfpt(self.sources, self.sinks, self.tprob, self.lag_time) ensemble_mfpt_ref = io.loadh(os.path.join(self.tpt_ref_dir, "ensemble_mfpt.h5"), 'Data') npt.assert_array_almost_equal(ensemble_mfpt, ensemble_mfpt_ref) all_to_all_mfpt = tpt.calculate_all_to_all_mfpt(self.tprob) all_to_all_mfpt_ref = io.loadh(os.path.join(self.tpt_ref_dir, "all_to_all_mfpt.h5"), 'Data') npt.assert_array_almost_equal(all_to_all_mfpt, all_to_all_mfpt_ref)