class_docstr: Creates a fading memory filter of order 0, 1, or 2.
  
  The KalmanFilter class also implements a more general fading memory
  filter and should be preferred in most cases. This is probably faster
  for low order systems.
  
  This algorithm is based on the fading filter algorithm developed in
  Zarcan's "Fundamentals of Kalman Filtering" [1].
  
  Parameters
  ----------
  
  x0 : 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)
  
  dt : scalar
      timestep
  
  order : int
      order of the filter. Defines the order of the system
      0 - assumes system of form x = a_0 + a_1*t
      1 - assumes system of form x = a_0 +a_1*t + a_2*t^2
      2 - assumes system of form x = a_0 +a_1*t + a_2*t^2 + a_3*t^3
  
  beta : float
      filter gain parameter.
  
  Attributes
  ----------
  
  x : np.array
      State of the filter.
      x[0] is the value being tracked
      x[1] is the derivative of x[0] (order 1 and 2 only)
      x[2] is the 2nd derivative of x[0] (order 2 only)
  
      This is always an np.array, even for order 0 where you can
      initialize x0 with a scalar.
  
  P : np.array
      The diagonal of the covariance matrix. Assumes that variance
      is one; multiply by sigma^2 to get the actual variances.
  
      This is a constant and will not vary as the filter runs.
  
  e : np.array
      The truncation error of the filter. Each term must be multiplied
      by the a_1, a_2, or a_3 of the polynomial for the system.
  
      For example, if the filter is order 2, then multiply all terms
      of self.e by a_3 to get the actual error. Multipy by a_2 for order
      1, and a_1 for order 0.
  
  
  References
  ----------
  
  Paul Zarchan and Howard Musoff. "Fundamentals of Kalman Filtering:
  A Practical Approach" American Institute of Aeronautics and Astronautics,
  Inc. Fourth Edition. p. 521-536. (2015)
docstr: update the filter with measurement z. z must be the same type
  (or treatable as the same type) as self.x[0].
code: def update(self, z):
      """update the filter with measurement z. z must be the same type
      (or treatable as the same type) as self.x[0].
      """
  
      if self.order == 0:
          G = 1 - self.beta
          self.x = self.x + dot(G, (z - self.x))
  
      elif self.order == 1:
          G = 1 - self.beta**2
          H = (1 - self.beta) ** 2
          x = self.x[0]
          dx = self.x[1]
          dxdt = dot(dx, self.dt)
  
          residual = z - (x + dxdt)
          self.x[0] = x + dxdt + G * residual
          self.x[1] = dx + (H / self.dt) * residual
  
      else:  # order == 2
          G = 1 - self.beta**3
          H = 1.5 * (1 + self.beta) * (1 - self.beta) ** 2
          K = 0.5 * (1 - self.beta) ** 3
  
          x = self.x[0]
          dx = self.x[1]
          ddx = self.x[2]
          dxdt = dot(dx, self.dt)
          T2 = self.dt**2.0
  
          residual = z - (x + dxdt + 0.5 * ddx * T2)
  
          self.x[0] = x + dxdt + 0.5 * ddx * T2 + G * residual
          self.x[1] = dx + ddx * self.dt + (H / self.dt) * residual
          self.x[2] = ddx + (2 * K / (self.dt**2)) * residual
  
file_path: filterpy/filterpy/memory/fading_memory.py
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 3 for calling the FadingMemoryFilter obj's underlying member method code with example usage: obj.update(z) without return types