filterpy/kalman/tests/test_kf.py
def const_vel_filter_2d(dt, x_ndim=1, P_diag=(1., 1, 1, 1), R_std=1., Q_var=0.0001):
    """ helper, constructs 1d, constant velocity filter"""

    kf = KalmanFilter (dim_x=4, dim_z=2)

    kf.x = np.array([[0., 0.0, 0., 0.]]).T
    kf.P *=  np.diag(P_diag)
    kf.F = np.array([[1, dt, 0, 0],
                     [0, 1, 0, 0],
                     [0, 0, 1, dt],
                     [0, 0, 0, 1]])

    kf.H = np.array([[1., 0, 0,  0],
                     [0., 0, 1, 0]])

    kf.R *= np.eye(2) * (R_std**2)
    q = Q_discrete_white_noise(dim=2, dt=dt, var=Q_var)
    kf.Q = block_diag(q, q)

    return kf
 helper, constructs 1d, constant velocity filter
helper, constructs 1d, constant velocity filter
helper constructs 1d constant velocity filter
def const_vel_filter_2d(dt, x_ndim=1, P_diag=(1., 1, 1, 1), R_std=1., Q_var=0.0001):
    kf = KalmanFilter (dim_x=4, dim_z=2)
    kf.x = np.array([[0., 0.0, 0., 0.]]).T
    kf.P *=  np.diag(P_diag)
    kf.F = np.array([[1, dt, 0, 0],
                     [0, 1, 0, 0],
                     [0, 0, 1, dt],
                     [0, 0, 0, 1]])
    kf.H = np.array([[1., 0, 0,  0],
                     [0., 0, 1, 0]])
    kf.R *= np.eye(2) * (R_std**2)
    q = Q_discrete_white_noise(dim=2, dt=dt, var=Q_var)
    kf.Q = block_diag(q, q)
    return kf
def const_vel_filter_2d ( dt , x_ndim = 1 , P_diag = ( 1. , 1 , 1 , 1 ) , R_std = 1. , Q_var = 0.0001 ) : kf = KalmanFilter ( dim_x = 4 , dim_z = 2 ) kf . x = np . array ( [ [ 0. , 0.0 , 0. , 0. ] ] ) . T kf . P *= np . diag ( P_diag ) kf . F = np . array ( [ [ 1 , dt , 0 , 0 ] , [ 0 , 1 , 0 , 0 ] , [ 0 , 0 , 1 , dt ] , [ 0 , 0 , 0 , 1 ] ] ) kf . H = np . array ( [ [ 1. , 0 , 0 , 0 ] , [ 0. , 0 , 1 , 0 ] ] ) kf . R *= np . eye ( 2 ) * ( R_std ** 2 ) q = Q_discrete_white_noise ( dim = 2 , dt = dt , var = Q_var ) kf . Q = block_diag ( q , q ) return kf
helper, constructs 1d, constant velocity filter
helper constructs 1d constant velocity filter
""" helper, constructs 1d, constant velocity filter"""
dt
x_ndim
P_diag
R_std
Q_var