code: def kf_circle():
      from filterpy.kalman import KalmanFilter
      from math import radians
      import math
  
      def hx(x):
          radius = x[0]
          angle = x[1]
          x = cos(radians(angle)) * radius
          y = sin(radians(angle)) * radius
          return np.array([x, y])
  
      def fx(x, dt):
          return np.array([x[0], x[1] + x[2], x[2]])
  
      def hx_inv(x, y):
          angle = math.atan2(y, x)
          radius = math.sqrt(x * x + y * y)
          return np.array([radius, angle])
  
      std_noise = 0.1
  
      kf = KalmanFilter(dim_x=3, dim_z=2)
      kf.x = np.array([50.0, 0.0, 0.0])
  
      F = np.array(
          [
              [1.0, 0, 0.0],
              [
                  0.0,
                  1.0,
                  1.0,
              ],
              [
                  0.0,
                  0.0,
                  1.0,
              ],
          ]
      )
  
      kf.F = F
      kf.P *= 100
      kf.H = np.array([[1, 0, 0], [0, 1, 0]])
  
      kf.R = np.eye(2) * (std_noise**2)
      # kf.Q[0:3, 0:3] = Q_discrete_white_noise(3, 1., .00001)
  
      zs = []
      kfxs = []
      for t in range(0, 2000):
          a = t / 30 + 90
          x = cos(radians(a)) * 50.0 + randn() * std_noise
          y = sin(radians(a)) * 50.0 + randn() * std_noise
  
          z = hx_inv(x, y)
          zs.append(z)
  
          kf.predict()
          kf.update(z)
  
          # save data
          kfxs.append(kf.x)
  
      zs = np.asarray(zs)
      kfxs = np.asarray(kfxs)
  
      if DO_PLOT:
          plt.plot(zs[:, 0], zs[:, 1], c="r", label="z")
          plt.plot(kfxs[:, 0], kfxs[:, 1], c="g", label="KF")
          plt.legend(loc="best")
          plt.axis("equal")
  
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 17 for calling a global function with example usage: kf_circle() and returns: np, np, np