code: def test_fixed_lag():
      def fx(x, dt):
          A = np.eye(3) + dt * np.array(
              [[0, 1, 0], [0, 0, 0], [0, 0, 0]]
          )
          f = np.dot(A, x)
          return f
  
      def hx(x):
          return np.sqrt(x[0] ** 2 + x[2] ** 2)
  
      dt = 0.05
  
      sp = JulierSigmaPoints(n=3, kappa=0)
  
      kf = UKF(3, 1, dt, fx=fx, hx=hx, points=sp)
  
      kf.Q *= 0.01
      kf.R = 10
      kf.x = np.array([0.0, 90.0, 1100.0])
      kf.P *= 1.0
      radar = RadarSim(dt)
  
      t = np.arange(0, 20 + dt, dt)
  
      n = len(t)
  
      xs = np.zeros((n, 3))
  
      random.seed(200)
      rs = []
      # xs = []
  
      M = []
      P = []
      N = 10
      flxs = []
      for i in range(len(t)):
          r = radar.get_range()
          # r = GetRadar(dt)
          kf.predict()
          kf.update(z=[r])
  
          xs[i, :] = kf.x
          flxs.append(kf.x)
          rs.append(r)
          M.append(kf.x)
          P.append(kf.P)
          print(i)
          # print(i, np.asarray(flxs)[:,0])
          if i == 20 and len(M) >= N:
              try:
                  M2, P2, K = kf.rts_smoother(
                      Xs=np.asarray(M)[-N:], Ps=np.asarray(P)[-N:]
                  )
                  flxs[-N:] = M2
                  # flxs[-N:] = [20]*N
              except:
                  print("except", i)
              # P[-N:] = P2
  
      kf.x = np.array([0.0, 90.0, 1100.0])
      kf.P = np.eye(3) * 100
      M, P = kf.batch_filter(rs)
  
      Qs = [kf.Q] * len(t)
      M2, P2, K = kf.rts_smoother(Xs=M, Ps=P, Qs=Qs)
  
      flxs = np.asarray(flxs)
      print(xs[:, 0].shape)
  
      plt.figure()
      plt.subplot(311)
      plt.plot(t, xs[:, 0])
      plt.plot(t, flxs[:, 0], c="r")
      plt.plot(t, M2[:, 0], c="g")
      plt.subplot(312)
      plt.plot(t, xs[:, 1])
      plt.plot(t, flxs[:, 1], c="r")
      plt.plot(t, M2[:, 1], c="g")
  
      plt.subplot(313)
      plt.plot(t, xs[:, 2])
      plt.plot(t, flxs[:, 2], c="r")
      plt.plot(t, M2[:, 2], c="g")
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import matplotlib.pyplot
  import numpy.random
  from numpy.random import randn
  from numpy import asarray
  import numpy
  from filterpy.kalman import UnscentedKalmanFilter
  from filterpy.kalman import unscented_transform, MerweScaledSigmaPoints, JulierSigmaPoints, SimplexSigmaPoints
  from filterpy.common import Q_discrete_white_noise
  import filterpy.stats
  from math import cos, sin
  from filterpy.kalman import UnscentedKalmanFilter2
label_desc: Use image node_id 15 for calling a global function with example usage: test_fixed_lag() and returns: f, np