def sqrt_kf_sim(sim):
"""
Process each simulation trial generated with
:func:`setup_random_test` with a Kalman filter and return the
posterior state estimates and error covariances.
"""
post = defaultdict(dict)
for l in range(sim['L']):
x_hat_l, P_sqrt_l = sqrt_kalman_filter(sim[l]['y'],
sim['H'],
sim['R_sqrt'],
sim['F'],
sim['Q_sqrt'],
sim['mu'],
sim['PI_sqrt'])
post[l]['x_hat'] = x_hat_l
if l == 0:
post['P'] = [NP.matmul(x, x.T) for x in P_sqrt_l]
post[l]['error'] = []
for x_i, x_hat_i in izip(sim[l]['x'], post[l]['x_hat']):
post[l]['error'].append(x_hat_i - x_i)
return post
评论列表
文章目录