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)
评论列表
文章目录