code: def test_1d_const_vel():
      def hx(x):
          return np.array([x[0]])
  
      F = np.array([[1.0, 1.0], [0.0, 1.0]])
  
      def fx(x, dt):
          return np.dot(F, x)
  
      x = np.array([0.0, 1.0])
      P = np.eye(2) * 100.0
      f = EnKF(x=x, P=P, dim_z=1, dt=1.0, N=8, hx=hx, fx=fx)
  
      std_noise = 10.0
  
      f.R *= std_noise**2
      f.Q = Q_discrete_white_noise(2, 1.0, 0.001)
  
      measurements = []
      results = []
      ps = []
      zs = []
      s = Saver(f)
      for t in range(0, 100):
          # create measurement = t plus white noise
          z = t + randn() * std_noise
          zs.append(z)
  
          f.predict()
          f.update(np.asarray([z]))
  
          # save data
          results.append(f.x[0])
          measurements.append(z)
          ps.append(3 * (f.P[0, 0] ** 0.5))
          s.save()
      s.to_array()
  
      results = np.asarray(results)
      ps = np.asarray(ps)
  
      if DO_PLOT:
          plt.plot(results, label="EnKF")
          plt.plot(measurements, c="r", label="z")
          plt.plot(
              results - ps, c="k", linestyle="--", label="3$\sigma$"
          )
          plt.plot(results + ps, c="k", linestyle="--")
          plt.legend(loc="best")
          # print(ps)
      return f
  
file_path: filterpy/filterpy/kalman/tests/test_enkf.py
imports: from numpy.random import randn
  import numpy
  import matplotlib.pyplot
  from filterpy.kalman import EnsembleKalmanFilter
  from filterpy.common import Q_discrete_white_noise, Saver
  from math import cos, sin
label_desc: Use image node_id 1 for calling a global function with example usage: test_1d_const_vel() and returns: f, np, np