code: def test_MMAE2():
      dt = 0.1
      pos, zs = generate_data(120, noise_factor=0.6)
      z_xs = zs[:, 0]
  
      dt = 0.1
      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, (0.5, 0.5), dim_x=3, H=ca.H)
  
      xs, probs = [], []
      cvxs, caxs = [], []
      s = Saver(bank)
      for i, z in enumerate(z_xs):
          bank.predict()
          bank.update(z)
          xs.append(bank.x[0])
          cvxs.append(cv.x[0])
          caxs.append(ca.x[0])
          print(i, cv.likelihood, ca.likelihood, bank.p)
          s.save()
          probs.append(bank.p[0] / bank.p[1])
      s.to_array()
  
      if DO_PLOT:
          plt.subplot(121)
          plt.plot(xs)
          plt.plot(pos[:, 0])
          plt.subplot(122)
          plt.plot(probs)
          plt.title("probability ratio p(cv)/p(ca)")
  
          plt.figure()
          plt.plot(cvxs, label="CV")
          plt.plot(caxs, label="CA")
          plt.plot(pos[:, 0])
          plt.legend()
  
          plt.figure()
          plt.plot(xs)
          plt.plot(pos[:, 0])
  
      return bank
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import numpy.random
  import numpy
  import matplotlib.pyplot
  from filterpy.kalman import KalmanFilter, MMAEFilterBank
  from numpy import array
  from filterpy.common import Q_discrete_white_noise, Saver
  import matplotlib.pyplot
  from numpy.random import randn
  from math import sin, cos, radians
label_desc: Use image node_id 5 for calling a global function with example usage: test_MMAE2() and returns: bank