code: def test_sequential_3d():
      N = 100
      dt = 0.02
      R_std = 1.0
  
      f_a = KalmanFilter(dim_x=6, dim_z=3)
      f_b = KalmanFilter(dim_x=6, dim_z=3)
      f_c = KalmanFilter(dim_x=6, dim_z=3)
      f_d = KalmanFilter(dim_x=6, dim_z=3)
  
      f_a.x = np.zeros([6, 1])
      f_b.x = np.copy(f_a.x)
      f_c.x = np.copy(f_a.x)
      f_d.x = np.copy(f_a.x)
  
      p = np.diag([1.0, 1.0])
      f_a.P = block_diag(p, p, p)
      f_b.P = np.copy(f_a.P)
      f_c.P = np.copy(f_a.P)
      f_d.P = np.copy(f_a.P)
  
      F1 = np.array([[1.0, dt], [0.0, 1.0]])
      f_a.F = block_diag(F1, F1, F1)
      f_b.F = f_a.F
      f_c.F = f_a.F
      f_d.F = f_a.F
  
      h = np.array([[1.0, 0.0]])
      f_a.H = block_diag(h, h, h)
      f_b.H = f_a.H
      f_c.H = f_a.H
      f_d.H = f_a.H
  
      f_a.R = np.eye(3) * (R_std**2)
      f_b.R = f_a.R
      f_c.R = f_a.R
      f_d.R = f_a.R
  
      q = Q_discrete_white_noise(dim=2, dt=dt, var=0.0001)
      f_a.Q = block_diag(q, q, q)
      f_b.Q = f_a.Q
      f_c.Q = f_a.Q
      f_d.Q = f_a.Q
  
      measurements = np.zeros([N, 3])
      results_a = np.zeros([N, 3])
  
      # velocity vector
      v = np.array([3.0, 4.0, 5.0])
  
      z = np.zeros([3, 1])
      for t in range(N):
          # create measurement = t plus white noise
          z[0, 0] = v[0] * t + random.randn() * 20
          z[1, 0] = v[1] * t + random.randn() * 20
          z[2, 0] = v[2] * t + random.randn() * 20
          measurements[t, :] = z[:, 0]
  
          # process as a single data vector
          f_a.predict()
          f_a.update(z)
  
          # process one component at a time
          f_b.predict()
          f_b.update_sequential(0, z[0])
          f_b.update_sequential(1, z[1])
          f_b.update_sequential(2, z[2])
  
          # process single component first
          f_c.predict()
          f_c.update_sequential(0, z[0])
          f_c.update_sequential(1, z[1:])
  
          # process double component first
          f_d.predict()
          f_d.update_sequential(0, z[:2])
          f_d.update_sequential(2, z[2])
  
          assert norm(f_a.x - f_b.x) < 1.0e-12
          assert norm(f_a.x - f_c.x) < 1.0e-12
          assert norm(f_a.x - f_d.x) < 1.0e-12
  
          assert norm(f_a.P - f_b.P) < 1.0e-12
          assert norm(f_a.P - f_c.P) < 1.0e-12
          assert norm(f_a.P - f_d.P) < 1.0e-12
  
          # save data
          results_a[t, 0:3] = f_a.x[0:6:2, 0]
  
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 6 for calling a global function with example usage: test_sequential_3d() without return types