• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python numeric.assert_allclose函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyemma.util.numeric.assert_allclose函数的典型用法代码示例。如果您正苦于以下问题:Python assert_allclose函数的具体用法?Python assert_allclose怎么用?Python assert_allclose使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了assert_allclose函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_pcca_1

 def test_pcca_1(self):
     P = np.array([[1, 0],
                   [0, 1]])
     chi = pcca(P, 2)
     sol = np.array([[1., 0.],
                     [0., 1.]])
     assert_allclose(chi, sol)
开发者ID:ismaelresp,项目名称:PyEMMA,代码行数:7,代码来源:pcca_test.py


示例2: test_count_matrix

    def test_count_matrix(self):
        """Small test cases"""
        C = count_matrix([self.S1, self.S2], 1, sliding=True).toarray()
        assert_allclose(C, self.B1_sliding)

        C = count_matrix([self.S1, self.S2], 2, sliding=True).toarray()
        assert_allclose(C, self.B2_sliding)
开发者ID:ismaelresp,项目名称:PyEMMA,代码行数:7,代码来源:test_count_matrix.py


示例3: test_fingerprint_relaxation

    def test_fingerprint_relaxation(self):
        one_vec = np.ones(self.T.shape[0])

        relax_amp = np.dot(self.p0, self.R) * np.dot(self.L, self.obs1)
        tsn, relax_ampn = fingerprint_relaxation(self.T, self.p0, self.obs1, k=self.k)
        assert_allclose(tsn, self.ts)
        assert_allclose(relax_ampn, relax_amp)
开发者ID:ismaelresp,项目名称:PyEMMA,代码行数:7,代码来源:fingerprints_test.py


示例4: test_hitting1

 def test_hitting1(self):
     P = np.array([[0., 1., 0.],
                   [0., 1., 0.],
                   [0., 0., 1.]])
     sol = np.array([1, 0, 0])
     assert_allclose(hitting_probability(P, 1), sol)
     assert_allclose(hitting_probability(P, [1, 2]), sol)
开发者ID:ismaelresp,项目名称:PyEMMA,代码行数:7,代码来源:hitting_probability_test.py


示例5: test_hitting2

 def test_hitting2(self):
     P = np.array([[1.0, 0.0, 0.0, 0.0],
                   [0.1, 0.8, 0.1, 0.0],
                   [0.0, 0.0, 0.8, 0.2],
                   [0.0, 0.0, 0.2, 0.8]])
     sol = np.array([0., 0.5, 1., 1.])
     assert_allclose(hitting_probability(P, [2, 3]), sol)
开发者ID:ismaelresp,项目名称:PyEMMA,代码行数:7,代码来源:hitting_probability_test.py


示例6: test_pathways_sparse

    def test_pathways_sparse(self):
        paths, capacities = pathways(self.F_sparse, self.A, self.B)
        self.assertTrue(len(paths) == len(self.paths))
        self.assertTrue(len(capacities) == len(self.capacities))

        for i in range(len(paths)):
            assert_allclose(paths[i], self.paths[i])
            assert_allclose(capacities[i], self.capacities[i])
开发者ID:ismaelresp,项目名称:PyEMMA,代码行数:8,代码来源:test_pathways.py


示例7: test_grossflux

    def test_grossflux(self):
        flux = self.bdc.flux(self.a, self.b)

        fluxn = self.tpt.gross_flux
        assert_allclose(fluxn, flux)

        fluxn = self.tpt_fast.gross_flux
        assert_allclose(fluxn, flux)
开发者ID:ismaelresp,项目名称:PyEMMA,代码行数:8,代码来源:test_tpt.py


示例8: test_totalflux

    def test_totalflux(self):
        F = self.bdc.totalflux(self.a, self.b)

        Fn = self.tpt.total_flux
        assert_allclose(Fn, F)

        Fn = self.tpt_fast.total_flux
        assert_allclose(Fn, F)
开发者ID:ismaelresp,项目名称:PyEMMA,代码行数:8,代码来源:test_tpt.py


示例9: test_stationary_distribution

    def test_stationary_distribution(self):
        mu = self.mu

        mun = self.tpt.stationary_distribution
        assert_allclose(mun, mu)

        mun = self.tpt_fast.stationary_distribution
        assert_allclose(mun, mu)
开发者ID:ismaelresp,项目名称:PyEMMA,代码行数:8,代码来源:test_tpt.py


示例10: test_forward_committor

    def test_forward_committor(self):
        qplus = self.qplus

        qplusn = self.tpt.forward_committor
        assert_allclose(qplusn, qplus)

        qplusn = self.tpt_fast.forward_committor
        assert_allclose(qplusn, qplus)
开发者ID:ismaelresp,项目名称:PyEMMA,代码行数:8,代码来源:test_tpt.py


示例11: test_rate

    def test_rate(self):
        k = self.bdc.rate(self.a, self.b)

        kn = self.tpt.rate
        assert_allclose(kn, k)

        kn = self.tpt_fast.rate
        assert_allclose(kn, k)
开发者ID:ismaelresp,项目名称:PyEMMA,代码行数:8,代码来源:test_tpt.py


示例12: test_backward_committor

    def test_backward_committor(self):
        qminus = self.qminus

        qminusn = self.tpt.backward_committor
        assert_allclose(qminusn, qminus)

        qminusn = self.tpt_fast.backward_committor
        assert_allclose(qminusn, qminus)
开发者ID:ismaelresp,项目名称:PyEMMA,代码行数:8,代码来源:test_tpt.py


示例13: test_connected_count_matrix

    def test_connected_count_matrix(self):
        """Directed"""
        C_cc = largest_connected_submatrix(self.C)
        assert_allclose(C_cc, self.C_cc_directed)

        """Undirected"""
        C_cc = largest_connected_submatrix(self.C, directed=False)
        assert_allclose(C_cc, self.C_cc_undirected)
开发者ID:ismaelresp,项目名称:PyEMMA,代码行数:8,代码来源:test_connectivity.py


示例14: test_prior_const

    def test_prior_const(self):
        with warnings.catch_warnings(record=True) as w:
            Bn = prior_const(self.C)
            assert_allclose(Bn, self.alpha_def * self.B_const)

        with warnings.catch_warnings(record=True) as w:
            Bn = prior_const(self.C, alpha=self.alpha)
            assert_allclose(Bn, self.alpha * self.B_const)
开发者ID:ismaelresp,项目名称:PyEMMA,代码行数:8,代码来源:test_prior.py


示例15: test_prior_rev

    def test_prior_rev(self):
        with warnings.catch_warnings(record=True) as w:
            Bn = prior_rev(self.C)
            assert_allclose(Bn, -1.0 * self.B_rev)

        with warnings.catch_warnings(record=True) as w:
            Bn = prior_rev(self.C, alpha=self.alpha)
            assert_allclose(Bn, self.alpha * self.B_rev)
开发者ID:ismaelresp,项目名称:PyEMMA,代码行数:8,代码来源:test_prior.py


示例16: test_netflux

    def test_netflux(self):
        netflux = self.bdc.netflux(self.a, self.b)

        netfluxn = self.tpt.net_flux
        assert_allclose(netfluxn, netflux)

        netfluxn = self.tpt_fast.net_flux
        assert_allclose(netfluxn, netflux)
开发者ID:ismaelresp,项目名称:PyEMMA,代码行数:8,代码来源:test_tpt.py


示例17: test_hitting3

 def test_hitting3(self):
     P = np.array([[0.9, 0.1, 0.0, 0.0, 0.0],
                   [0.1, 0.9, 0.0, 0.0, 0.0],
                   [0.0, 0.1, 0.4, 0.5, 0.0],
                   [0.0, 0.0, 0.0, 0.8, 0.2],
                   [0.0, 0.0, 0.0, 0.2, 0.8]])
     sol = np.array([0.0, 0.0, 8.33333333e-01, 1.0, 1.0])
     assert_allclose(hitting_probability(P, 3), sol)
     assert_allclose(hitting_probability(P, [3, 4]), sol)
开发者ID:ismaelresp,项目名称:PyEMMA,代码行数:9,代码来源:hitting_probability_test.py


示例18: test_timescales_2

    def test_timescales_2(self):
        """Eigenvalues with non-zero imaginary part"""
        ts = np.array([np.inf, 0.971044, 0.971044])

        with warnings.catch_warnings(record=True) as w:
            warnings.simplefilter("always")
            tsn = timescales(0.5 * self.T + 0.5 * self.P)
            assert_allclose(tsn, ts)
            assert issubclass(w[-1].category, ImaginaryEigenValueWarning)
开发者ID:ismaelresp,项目名称:PyEMMA,代码行数:9,代码来源:test_decomposition.py


示例19: test_pcca_2

 def test_pcca_2(self):
     P = np.array([[0.0, 1.0, 0.0],
                   [0.0, 0.999, 0.001],
                   [0.0, 0.001, 0.999]])
     chi = pcca(P, 2)
     sol = np.array([[1., 0.],
                     [1., 0.],
                     [0., 1.]])
     assert_allclose(chi, sol)
开发者ID:ismaelresp,项目名称:PyEMMA,代码行数:9,代码来源:pcca_test.py


示例20: test_relaxation_matvec

 def test_relaxation_matvec(self):
     times = self.times
     P = self.T.toarray()
     relax = np.zeros(len(times))
     for i in range(len(times)):
         P_t = np.linalg.matrix_power(P, times[i])
         relax[i] = np.dot(self.p0, np.dot(P_t, self.obs))
     relaxn = relaxation_matvec(self.T, self.p0, self.obs, times=self.times)
     assert_allclose(relaxn, relax)
开发者ID:ismaelresp,项目名称:PyEMMA,代码行数:9,代码来源:fingerprints_test.py



注:本文中的pyemma.util.numeric.assert_allclose函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pyeq2.dataConvertorService函数代码示例发布时间:2022-05-25
下一篇:
Python pyemd.emd函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap