code: def test_batch_equals_recursive():
      """ensures that the batch filter and the recursive version both
      produce the same results.
      """
  
      N = 4  # size of lag
  
      fls = FixedLagSmoother(dim_x=2, dim_z=1, N=N)
  
      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
  
      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)
  
      for k, z in enumerate(zs):
          fls.smooth(z)
  
      xSmooth = np.asarray(fls.xSmooth)
      xfl = xs[:, 0].T[0]
  
      res = xSmooth.T[0, 0] - xfl
  
      assert np.sum(res) < 1.0e-12
  
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 2 for calling a global function with example usage: test_batch_equals_recursive() without return types