def test_mult_simPQ(self):
"""Test the sensitivity calculation for multiple experiments
"""
new = self.bayes.update(simulations={'simple1': [self.sim1, self.exp1],
'simple2': [self.sim1, self.exp1]})
initial_data = new.get_data()
sens_matrix = new._get_sens(initial_data=initial_data)
P, q = new._get_sim_pq(initial_data, sens_matrix)
sigma = self.exp1.get_sigma()
P_true = np.dot(np.dot(sens_matrix['simple1'].T,
inv(sigma)),
sens_matrix['simple1'])
P_true += P_true
npt.assert_array_almost_equal(P, P_true, decimal=8)
epsilon = new.simulations['simple1']['exp'].\
compare(initial_data['simple1'])
q_true = -np.dot(np.dot(epsilon, inv(sigma)), sens_matrix['simple1'])
q_true += q_true
npt.assert_array_almost_equal(q, q_true, decimal=8)
评论列表
文章目录