test_Simulation.py 文件源码

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

项目:F_UNCLE 作者: fraserphysics 项目源码 文件源码
def test_pll_sens(self):
        """Test sensitivity calculation
        """
        models = {'simp': SimpleModel([2, 1])}

        t0 = time.time()
        sens = self.simSimp.get_sens_pll(models, 'simp')
        t0 = time.time() - t0
        print('Parallel sense took {:f}'.format(t0))

        self.assertIsInstance(sens, np.ndarray)
        self.assertEqual(sens.shape, (10, 2))

        indep = np.arange(10)
        resp_mat = np.array([(1.02 * 2 * indep)**2 + 1 * indep -
                             (2 * indep)**2 - indep,
                             (2 * indep)**2 + 1.02 * indep -
                             (2 * indep)**2 - 1 * indep])
        inp_mat = np.array([[0.02 * 2, 0], [0, 0.02]])
        true_sens = np.linalg.lstsq(inp_mat, resp_mat)[0].T

        npt.assert_array_almost_equal(sens, true_sens, decimal=8)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号