class_docstr: Implements the g-h-k filter.
  
  Parameters
  ----------
  
  x : 1D np.array or scalar
      Initial value for the filter state. Each value can be a scalar
      or a np.array.
  
      You can use a scalar for x0. If order > 0, then 0.0 is assumed
      for the higher order terms.
  
      x[0] is the value being tracked
      x[1] is the first derivative (for order 1 and 2 filters)
      x[2] is the second derivative (for order 2 filters)
  
  dx : 1D np.array or scalar
      Initial value for the derivative of the filter state.
  
  ddx : 1D np.array or scalar
      Initial value for the second derivative of the filter state.
  
  dt : scalar
      time step
  
  g : float
      filter g gain parameter.
  
  h : float
      filter h gain parameter.
  
  k : float
      filter k gain parameter.
  
  
  
  Attributes
  ----------
  x : 1D np.array or scalar
      filter state
  
  dx : 1D np.array or scalar
     derivative of the filter state.
  
  ddx : 1D np.array or scalar
     second derivative of the filter state.
  
  x_prediction : 1D np.array or scalar
      predicted filter state
  
  dx_prediction : 1D np.array or scalar
     predicted derivative of the filter state.
  
  ddx_prediction : 1D np.array or scalar
     second predicted derivative of the filter state.
  
  dt : scalar
      time step
  
  g : float
      filter g gain parameter.
  
  h : float
      filter h gain parameter.
  
  k : float
      filter k gain parameter.
  
  y : np.array, or scalar
      residual (difference between measurement and prior)
  
  z : np.array, or scalar
      measurement passed into update()
  
  References
  ----------
  
  Brookner, "Tracking and Kalman Filters Made Easy". John Wiley and
  Sons, 1998.
class_docstr_tok: ["Implements","the","g-h-k","filter",".","Parameters","--","--","--","--","--","x",":","1D","np.array","or","scalar","Initial","value","for","the","filter","state",".","Each","value","can","be","a","scalar","or","a","np.array",".","You","can","use","a","scalar","for","x0",".","If","order",">","0",",","then","0.0","is","assumed","for","the","higher","order","terms",".","x","[","0","]","is","the","value","being","tracked","x","[","1","]","is","the","first","derivative","(","for","order","1","and","2","filters",")","x","[","2","]","is","the","second","derivative","(","for","order","2","filters",")","dx",":","1D","np.array","or","scalar","Initial","value","for","the","derivative","of","the","filter","state",".","ddx",":","1D","np.array","or","scalar","Initial","value","for","the","second","derivative","of","the","filter","state",".","dt",":","scalar","time","step","g",":","float","filter","g","gain","parameter",".","h",":","float","filter","h","gain","parameter",".","k",":","float","filter","k","gain","parameter",".","Attributes","--","--","--","--","--","x",":","1D","np.array","or","scalar","filter","state","dx",":","1D","np.array","or","scalar","derivative","of","the","filter","state",".","ddx",":","1D","np.array","or","scalar","second","derivative","of","the","filter","state",".","x_prediction",":","1D","np.array","or","scalar","predicted","filter","state","dx_prediction",":","1D","np.array","or","scalar","predicted","derivative","of","the","filter","state",".","ddx_prediction",":","1D","np.array","or","scalar","second","predicted","derivative","of","the","filter","state",".","dt",":","scalar","time","step","g",":","float","filter","g","gain","parameter",".","h",":","float","filter","h","gain","parameter",".","k",":","float","filter","k","gain","parameter",".","y",":","np.array",",","or","scalar","residual","(","difference","between","measurement","and","prior",")","z",":","np.array",",","or","scalar","measurement","passed","into","update","(",")","References","--","--","--","--","--","Brookner",",","``","Tracking","and","Kalman","Filters","Made","Easy","''",".","John","Wiley","and","Sons",",","1998","."]
docstr: Returns the Variance Reduction Factor (VRF) of the state variable
  of the filter (x) and its derivatives (dx, ddx). The VRF is the
  normalized variance for the filter, as given in the equations below.
  
  .. math::
      VRF(\hat{x}_{n,n}) = \\frac{VAR(\hat{x}_{n,n})}{\sigma^2_x}
  
      VRF(\hat{\dot{x}}_{n,n}) = \\frac{VAR(\hat{\dot{x}}_{n,n})}{\sigma^2_x}
  
      VRF(\hat{\ddot{x}}_{n,n}) = \\frac{VAR(\hat{\ddot{x}}_{n,n})}{\sigma^2_x}
  
  Returns
  -------
  
  vrf_x : type(x)
      VRF of x state variable
  
  vrf_dx : type(x)
      VRF of the dx state variable (derivative of x)
  
  vrf_ddx : type(x)
      VRF of the ddx state variable (second derivative of x)
docstr_tok: ["Returns","the","Variance","Reduction","Factor","(","VRF",")","of","the","state","variable","of","the","filter","(","x",")","and","its","derivatives","(","dx",",","ddx",")",".","The","VRF","is","the","normalized","variance","for","the","filter",",","as","given","in","the","equations","below",".","..","math",":",":","VRF","(","\\hat","{","x","}","_","{","n",",","n","}",")","=","\\\\frac","{","VAR","(","\\hat","{","x","}","_","{","n",",","n","}",")","}","{","\\sigma^2_x","}","VRF","(","\\hat","{","\\dot","{","x","}","}","_","{","n",",","n","}",")","=","\\\\frac","{","VAR","(","\\hat","{","\\dot","{","x","}","}","_","{","n",",","n","}",")","}","{","\\sigma^2_x","}","VRF","(","\\hat","{","\\ddot","{","x","}","}","_","{","n",",","n","}",")","=","\\\\frac","{","VAR","(","\\hat","{","\\ddot","{","x","}","}","_","{","n",",","n","}",")","}","{","\\sigma^2_x","}","Returns","--","--","--","-","vrf_x",":","type","(","x",")","VRF","of","x","state","variable","vrf_dx",":","type","(","x",")","VRF","of","the","dx","state","variable","(","derivative","of","x",")","vrf_ddx",":","type","(","x",")","VRF","of","the","ddx","state","variable","(","second","derivative","of","x",")"]
code: def VRF(self):
      r"""
      Returns the Variance Reduction Factor (VRF) of the state variable
      of the filter (x) and its derivatives (dx, ddx). The VRF is the
      normalized variance for the filter, as given in the equations below.
  
      .. math::
          VRF(\hat{x}_{n,n}) = \\frac{VAR(\hat{x}_{n,n})}{\sigma^2_x}
  
          VRF(\hat{\dot{x}}_{n,n}) = \\frac{VAR(\hat{\dot{x}}_{n,n})}{\sigma^2_x}
  
          VRF(\hat{\ddot{x}}_{n,n}) = \\frac{VAR(\hat{\ddot{x}}_{n,n})}{\sigma^2_x}
  
      Returns
      -------
  
      vrf_x : type(x)
          VRF of x state variable
  
      vrf_dx : type(x)
          VRF of the dx state variable (derivative of x)
  
      vrf_ddx : type(x)
          VRF of the ddx state variable (second derivative of x)
      """
  
      g = self.g
      h = self.h
      k = self.k
  
      # common subexpressions in the equations pulled out for efficiency,
      # they don't 'mean' anything.
      hg4 = 4 - 2 * g - h
      ghk = g * h + g * k - 2 * k
  
      vx = (
          2 * h * (2 * (g**2) + 2 * h - 3 * g * h) - 2 * g * k * hg4
      ) / (2 * k - g * (h + k) * hg4)
      vdx = (
          2 * (h**3) - 4 * (h**2) * k + 4 * (k**2) * (2 - g)
      ) / (2 * hg4 * ghk)
      vddx = 8 * h * (k**2) / ((self.dt**4) * hg4 * ghk)
  
      return (vx, vdx, vddx)
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import numpy
  from numpy import dot
  from filterpy.common import pretty_str
label_desc: Use image node_id 6 for calling the GHKFilter obj's underlying member method code with example usage: obj.VRF() and returns: vx,  vdx,  vddx