code: def test_1d_vel():
      from scipy.linalg import inv
      from numpy import dot
  
      global ks
      dt = 1.0
      std_z = 0.0001
  
      x = np.array([[0.0], [0.0]])
  
      F = np.array([[1.0, dt], [0.0, 1.0]])
  
      H = np.array([[1.0, 0.0]])
      P = np.eye(2)
      R = np.eye(1) * std_z**2
      Q = np.eye(2) * 0.001
  
      measurements = []
  
      xest = []
      ks = []
      pos = 0.0
      for t in range(20):
          z = pos + random.randn() * std_z
          pos += 100
  
          # perform kalman filtering
          x = dot(F, x)
          P = dot(dot(F, P), F.T) + Q
  
          P2 = P.copy()
          P2[0, 1] = 0  # force there to be no correlation
          P2[1, 0] = 0
          S = dot(dot(H, P2), H.T) + R
          K = dot(dot(P2, H.T), inv(S))
          y = z - dot(H, x)
          x = x + dot(K, y)
  
          # save data
          xest.append(x.copy())
          measurements.append(z)
          ks.append(K.copy())
  
      xest = np.array(xest)
      ks = np.array(ks)
      # plot data
      if DO_PLOT:
          plt.subplot(121)
          plt.plot(xest[:, 1])
          plt.subplot(122)
          plt.plot(ks[:, 1])
          plt.show()
  
imports: from __future__ import absolute_import, division, print_function
  import numpy.random
  from numpy.random import randn
  import numpy
  import matplotlib.pyplot
  from pytest import approx
  from filterpy.kalman import KalmanFilter, update, predict, batch_filter
  from filterpy.common import Q_discrete_white_noise, kinematic_kf, Saver
  from filterpy.stats import mahalanobis
  from scipy.linalg import block_diag, norm
label_desc: Use image node_id 4 for calling a global function with example usage: test_1d_vel() without return types