code: def test_vhartman():
      """
      Code provided by vhartman on github #172
  
      https://github.com/rlabbe/filterpy/issues/172
      """
  
      def fx(x, dt):
          # state transition function - predict next state based
          # on constant velocity model x = vt + x_0
          F = np.array([[1.0]], dtype=np.float32)
          return np.dot(F, x)
  
      def hx(x):
          # measurement function - convert state into a measurement
          # where measurements are [x_pos, y_pos]
          return np.array([x[0]])
  
      dt = 1.0
      # create sigma points to use in the filter. This is standard for Gaussian processes
      points = MerweScaledSigmaPoints(1, alpha=1, beta=2.0, kappa=0.1)
  
      kf = UnscentedKalmanFilter(
          dim_x=1, dim_z=1, dt=dt, fx=fx, hx=hx, points=points
      )
      kf.x = np.array([0.0])  # initial state
      kf.P = np.array([[1]])  # initial uncertainty
      kf.R = np.diag([1])  # 1 standard
      kf.Q = np.diag([1])  # 1 standard
  
      ekf = ExtendedKalmanFilter(dim_x=1, dim_z=1)
      ekf.F = np.array([[1]])
  
      ekf.x = np.array([0.0])  # initial state
      ekf.P = np.array([[1]])  # initial uncertainty
      ekf.R = np.diag([1])  # 1 standard
      ekf.Q = np.diag([1])  # 1 standard
  
      np.random.seed(0)
      zs = [[np.random.randn()] for i in range(50)]  # measurements
      for z in zs:
          kf.predict()
          ekf.predict()
          assert np.allclose(ekf.P, kf.P)
          assert np.allclose(ekf.x, kf.x)
  
          kf.update(z)
          ekf.update(z, lambda x: np.array([[1]]), hx)
          assert np.allclose(ekf.P, kf.P)
          assert np.allclose(ekf.x, kf.x)
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  from math import cos, sin
  import matplotlib.pyplot
  import numpy.random
  from numpy.random import randn
  from numpy import asarray
  import numpy
  from pytest import approx
  import scipy.linalg
  from scipy.spatial.distance import mahalanobis
  from filterpy.kalman import ExtendedKalmanFilter
  from filterpy.kalman import UnscentedKalmanFilter
  from filterpy.kalman import unscented_transform, MerweScaledSigmaPoints, JulierSigmaPoints, SimplexSigmaPoints, KalmanFilter
  from filterpy.common import Q_discrete_white_noise, Saver
  import filterpy.stats
label_desc: Use image node_id 19 for calling a global function with example usage: test_vhartman() and returns: np, np