code: def one_run_test_fls():
      fls = FixedLagSmoother(dim_x=2, dim_z=1)
  
      fls.x = np.array([0.0, 0.5])
      fls.F = np.array([[1.0, 1.0], [0.0, 1.0]])
  
      fls.H = np.array([[1.0, 0.0]])
      fls.P *= 200
      fls.R *= 5.0
      fls.Q *= 0.001
  
      kf = KalmanFilter(dim_x=2, dim_z=1)
  
      kf.x = np.array([0.0, 0.5])
      kf.F = np.array([[1.0, 1.0], [0.0, 1.0]])
      kf.H = np.array([[1.0, 0.0]])
      kf.P *= 2000
      kf.R *= 1.0
      kf.Q *= 0.001
  
      N = 4  # size of lag
  
      nom = np.array([t / 2.0 for t in range(0, 40)])
      zs = np.array([t + random.randn() * 1.1 for t in nom])
  
      xs, x = fls.smooth_batch(zs, N)
  
      M, P, _, _ = kf.batch_filter(zs)
      rts_x, _, _, _ = kf.rts_smoother(M, P)
  
      xfl = xs[:, 0].T[0]
      xkf = M[:, 0].T[0]
  
      fl_res = abs(xfl - nom)
      kf_res = abs(xkf - nom)
  
      if DO_PLOT:
          plt.cla()
          plt.plot(zs, "o", alpha=0.5, marker="o", label="zs")
          plt.plot(x[:, 0], label="FLS")
          plt.plot(xfl, label="FLS S")
          plt.plot(xkf, label="KF")
          plt.plot(rts_x[:, 0], label="RTS")
          plt.legend(loc=4)
          plt.show()
  
          print(fl_res)
          print(kf_res)
  
          print("std fixed lag:", np.mean(fl_res[N:]))
          print("std kalman:", np.mean(kf_res[N:]))
  
      return np.mean(fl_res) <= np.mean(kf_res)
  
file_path: filterpy/filterpy/kalman/tests/test_fls.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import numpy
  from numpy import random
  import matplotlib.pyplot
  from filterpy.kalman import KalmanFilter, FixedLagSmoother
label_desc: Use image node_id 3 for calling a global function with example usage: one_run_test_fls() and returns: unknown