code: def test_against_kf():
      inv = np.linalg.inv
  
      dt = 1.0
      IM = np.eye(2)
      Q = np.array([[0.25, 0.5], [0.5, 1]])
  
      F = np.array([[1, dt], [0, 1]])
      # QI = inv(Q)
      P = inv(IM)
  
      from filterpy.kalman import InformationFilter
      from filterpy.common import Q_discrete_white_noise
  
      # f = IF2(2, 1)
      r_std = 0.2
      R = np.array([[r_std * r_std]])
      RI = inv(R)
  
      """f.F = F.copy()
      f.H = np.array([[1, 0.]])
      f.RI = RI.copy()
      f.Q = Q.copy()
      f.IM = IM.copy()"""
  
      kf = KalmanFilter(2, 1)
      kf.F = F.copy()
      kf.H = np.array([[1, 0.0]])
      kf.R = R.copy()
      kf.Q = Q.copy()
  
      f0 = InformationFilter(2, 1)
      f0.F = F.copy()
      f0.H = np.array([[1, 0.0]])
      f0.R_inv = RI.copy()
      f0.Q = Q.copy()
  
      # f.IM = np.zeros((2,2))
  
      for i in range(1, 50):
          z = i + (np.random.rand() * r_std)
          f0.predict()
          # f.predict()
          kf.predict()
  
          f0.update(z)
          # f.update(z)
          kf.update(z)
  
          print(f0.x.T, kf.x.T)
          assert np.allclose(f0.x, kf.x)
  
file_path: filterpy/filterpy/kalman/tests/test_information.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import numpy.random
  import numpy
  import matplotlib.pyplot
  from filterpy.common import Saver
  from filterpy.kalman import KalmanFilter, InformationFilter
label_desc: Use image node_id 3 for calling a global function with example usage: test_against_kf() without return types