filterpy/kalman/tests/test_kf.py
def const_vel_filter(dt, x0=0, x_ndim=1, P_diag=(1., 1.), R_std=1., Q_var=0.0001):
    """ helper, constructs 1d, constant velocity filter"""
    f = KalmanFilter (dim_x=2, dim_z=1)

    if x_ndim == 1:
        f.x = np.array([x0, 0])
    else:
        f.x = np.array([[x0, 0]]).T

    f.F = np.array([[1., dt],
                    [0., 1.]])

    f.H = np.array([[1.,0.]])
    f.P = np.diag(P_diag)
    f.R = np.eye(1) * (R_std**2)
    f.Q = Q_discrete_white_noise(2, dt, Q_var)

    return f
 helper, constructs 1d, constant velocity filter
helper, constructs 1d, constant velocity filter
helper constructs 1d constant velocity filter
def const_vel_filter(dt, x0=0, x_ndim=1, P_diag=(1., 1.), R_std=1., Q_var=0.0001):
    f = KalmanFilter (dim_x=2, dim_z=1)
    if x_ndim == 1:
        f.x = np.array([x0, 0])
    else:
        f.x = np.array([[x0, 0]]).T
    f.F = np.array([[1., dt],
                    [0., 1.]])
    f.H = np.array([[1.,0.]])
    f.P = np.diag(P_diag)
    f.R = np.eye(1) * (R_std**2)
    f.Q = Q_discrete_white_noise(2, dt, Q_var)
    return f
def const_vel_filter ( dt , x0 = 0 , x_ndim = 1 , P_diag = ( 1. , 1. ) , R_std = 1. , Q_var = 0.0001 ) : f = KalmanFilter ( dim_x = 2 , dim_z = 1 ) if x_ndim == 1 : f . x = np . array ( [ x0 , 0 ] ) else : f . x = np . array ( [ [ x0 , 0 ] ] ) . T f . F = np . array ( [ [ 1. , dt ] , [ 0. , 1. ] ] ) f . H = np . array ( [ [ 1. , 0. ] ] ) f . P = np . diag ( P_diag ) f . R = np . eye ( 1 ) * ( R_std ** 2 ) f . Q = Q_discrete_white_noise ( 2 , dt , Q_var ) return f
helper, constructs 1d, constant velocity filter
helper constructs 1d constant velocity filter
""" helper, constructs 1d, constant velocity filter"""
dt
x0
x_ndim
P_diag
R_std
Q_var