MMAE Filter Bank

needs documentation....


from filterpy.kalman import MMAEFilterBank

pos, zs = generate_data(120, noise_factor=0.2)
z_xs = zs[:, 0]
t = np.arange(0, len(z_xs) * dt, dt)

dt = 0.1
filters = [make_cv_filter(dt), make_ca_filter(dt)]
H_cv = np.array([[1., 0, 0],
                 [0., 1, 0]])

H_ca = np.array([[1., 0., 0.],
                 [0., 1., 0.],
                 [0., 0., 1.]])

bank = MMAEFilterBank(filters, (0.5, 0.5), dim_x=3, H=(H_cv, H_ca))

xs, probs = [], []
for z in z_xs:


Copyright 2015 Roger R Labbe Jr.

FilterPy library.

Documentation at:

Supporting book at:

This is licensed under an MIT license. See the readme.MD file for more information.

class filterpy.kalman.MMAEFilterBank(filters, p, dim_x, H=None)[source]

Implements the fixed Multiple Model Adaptive Estimator (MMAE). This is a bank of independent Kalman filters. This estimator computes the likelihood that each filter is the correct one, and blends their state estimates weighted by their likelihood to produce the state estimate.


Zarchan and Musoff. “Fundamentals of Kalman filtering: A Practical Approach.” AIAA, third edition.



ca = make_ca_filter(dt, noise_factor=0.6) cv = make_ca_filter(dt, noise_factor=0.6) cv.F[:,2] = 0 # remove acceleration term cv.P[2,2] = 0 cv.Q[2,2] = 0

filters = [cv, ca] bank = MMAEFilterBank(filters, p=(0.5, 0.5), dim_x=3)

for z in zs:
bank.predict() bank.update(z)
__init__(filters, p, dim_x, H=None)[source]

Creates an fixed MMAE Estimator.


filters : list of Kalman filters

List of Kalman filters.

p : list-like of floats

Initial probability that each filter is the correct one. In general you’d probably set each element to 1./len(p).

dim_x : float

number of random variables in the state X

H :


The estimated state of the bank of filters.


Estimated covariance of the bank of filters.


Predict next position using the Kalman filter state propagation equations for each filter in the bank.


u : np.array

Optional control vector. If non-zero, it is multiplied by B to create the control input into the system.

update(z, R=None, H=None)[source]

Add a new measurement (z) to the Kalman filter. If z is None, nothing is changed.


z : np.array

measurement for this update.

R : np.array, scalar, or None

Optionally provide R to override the measurement noise for this one call, otherwise self.R will be used.

H : np.array, or None

Optionally provide H to override the measurement function for this one call, otherwise self.H will be used.