test_Bayesian.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:F_UNCLE 作者: fraserphysics 项目源码 文件源码
def test_multiple_calls(self):
        """Tests that the results are the same after calling multiple times
        """
        bayes = Bayesian(simulations={'Gun': [self.sim1, self.exp1]},
                         models={'eos': self.eos_model},
                         opt_keys='eos')

        sol1, hist1, sens1, fisher1 = bayes()

        sol2, hist2, sens2, fisher2 = bayes()

        npt.assert_almost_equal(hist1[0], hist2[0], decimal=4,
                                err_msg='Histories not equal for subsequent'
                                        'runs')

        npt.assert_almost_equal(sol1.models['eos'].get_dof() /
                                sol2.models['eos'].get_dof(),
                                np.ones(bayes.shape()[1]),
                                decimal=10,
                                err_msg='DOF not equal for subsequent runs')
        npt.assert_almost_equal(np.fabs(sens1['Gun'] - sens2['Gun']),
                                np.zeros(sens1['Gun'].shape),
                                decimal=10)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号