class_docstr: Implements the Cubuture Kalman filter (UKF) as defined by
  Ienkaran Arasaratnam and Simon Haykin in [1]
  
  
  You will have to set the following attributes after constructing this
  object for the filter to perform properly.
  
  
  Parameters
  ----------
  
  dim_x : int
      Number of state variables for the filter. For example, if
      you are tracking the position and velocity of an object in two
      dimensions, dim_x would be 4.
  
  
  dim_z : int
      Number of of measurement inputs. For example, if the sensor
      provides you with position in (x,y), dim_z would be 2.
  
  dt : float
      Time between steps in seconds.
  
  hx : function(x)
      Measurement function. Converts state vector x into a measurement
      vector of shape (dim_z).
  
  fx : function(x, dt)
      function that returns the state x transformed by the
      state transition function. dt is the time step in seconds.
  
  x_mean_fn : callable  (sigma_points, weights), optional
      Function that computes the mean of the provided sigma points
      and weights. Use this if your state variable contains nonlinear
      values such as angles which cannot be summed.
  
      .. code-block:: Python
  
          def state_mean(sigmas, Wm):
              x = np.zeros(3)
              sum_sin, sum_cos = 0., 0.
  
              for i in range(len(sigmas)):
                  s = sigmas[i]
                  x[0] += s[0] * Wm[i]
                  x[1] += s[1] * Wm[i]
                  sum_sin += sin(s[2])*Wm[i]
                  sum_cos += cos(s[2])*Wm[i]
              x[2] = atan2(sum_sin, sum_cos)
              return x
  
  z_mean_fn : callable  (sigma_points, weights), optional
      Same as x_mean_fn, except it is called for sigma points which
      form the measurements after being passed through hx().
  
  residual_x : callable (x, y), optional
  residual_z : callable (x, y), optional
      Function that computes the residual (difference) between x and y.
      You will have to supply this if your state variable cannot support
      subtraction, such as angles (359-1 degreees is 2, not 358). x and y
      are state vectors, not scalars. One is for the state variable,
      the other is for the measurement state.
  
      .. code-block:: Python
  
          def residual(a, b):
              y = a[0] - b[0]
              if y > np.pi:
                  y -= 2*np.pi
              if y < -np.pi:
                  y = 2*np.pi
              return y
  
  Attributes
  ----------
  
  x : numpy.array(dim_x)
      state estimate vector
  
  P : numpy.array(dim_x, dim_x)
      covariance estimate matrix
  
  x_prior : numpy.array(dim_x, 1)
      Prior (predicted) state estimate. The *_prior and *_post attributes
      are for convienence; they store the  prior and posterior of the
      current epoch. Read Only.
  
  P_prior : numpy.array(dim_x, dim_x)
      Prior (predicted) state covariance matrix. Read Only.
  
  x_post : numpy.array(dim_x, 1)
      Posterior (updated) state estimate. Read Only.
  
  P_post : numpy.array(dim_x, dim_x)
      Posterior (updated) state covariance matrix. Read Only
  
  R : numpy.array(dim_z, dim_z)
      measurement noise matrix
  
  Q : numpy.array(dim_x, dim_x)
      process noise matrix
  
  K : numpy.array
      Kalman gain. Read only.
  
  y : numpy.array
      innovation residual. Read only.
  
  z : ndarray
      Last measurement used in update(). Read only.
  
  log_likelihood : float
      log-likelihood of the last measurement. Read only.
  
  likelihood : float
      likelihood of last measurment. Read only.
  
      Computed from the log-likelihood. The log-likelihood can be very
      small,  meaning a large negative value such as -28000. Taking the
      exp() of that results in 0.0, which can break typical algorithms
      which multiply by this value, so by default we always return a
      number >= sys.float_info.min.
  
  mahalanobis : float
      mahalanobis distance of the innovation. Read only.
  
  References
  ----------
  
  .. [1] Arasaratnam, I, Haykin, S. "Cubature Kalman Filters,"
     IEEE Transactions on Automatic Control, 2009, pp 1254-1269, vol 54, No 6
class_docstr_tok: ["Implements","the","Cubuture","Kalman","filter","(","UKF",")","as","defined","by","Ienkaran","Arasaratnam","and","Simon","Haykin","in","[","1","]","You","will","have","to","set","the","following","attributes","after","constructing","this","object","for","the","filter","to","perform","properly",".","Parameters","--","--","--","--","--","dim_x",":","int","Number","of","state","variables","for","the","filter",".","For","example",",","if","you","are","tracking","the","position","and","velocity","of","an","object","in","two","dimensions",",","dim_x","would","be","4.","dim_z",":","int","Number","of","of","measurement","inputs",".","For","example",",","if","the","sensor","provides","you","with","position","in","(","x",",","y",")",",","dim_z","would","be","2.","dt",":","float","Time","between","steps","in","seconds",".","hx",":","function","(","x",")","Measurement","function",".","Converts","state","vector","x","into","a","measurement","vector","of","shape","(","dim_z",")",".","fx",":","function","(","x",",","dt",")","function","that","returns","the","state","x","transformed","by","the","state","transition","function",".","dt","is","the","time","step","in","seconds",".","x_mean_fn",":","callable","(","sigma_points",",","weights",")",",","optional","Function","that","computes","the","mean","of","the","provided","sigma","points","and","weights",".","Use","this","if","your","state","variable","contains","nonlinear","values","such","as","angles","which","can","not","be","summed",".","..","code-block",":",":","Python","def","state_mean","(","sigmas",",","Wm",")",":","x","=","np.zeros","(","3",")","sum_sin",",","sum_cos","=","0.",",","0.","for","i","in","range","(","len","(","sigmas",")",")",":","s","=","sigmas","[","i","]","x","[","0","]","+=","s","[","0","]","*","Wm","[","i","]","x","[","1","]","+=","s","[","1","]","*","Wm","[","i","]","sum_sin","+=","sin","(","s","[","2","]",")","*","Wm","[","i","]","sum_cos","+=","cos","(","s","[","2","]",")","*","Wm","[","i","]","x","[","2","]","=","atan2","(","sum_sin",",","sum_cos",")","return","x","z_mean_fn",":","callable","(","sigma_points",",","weights",")",",","optional","Same","as","x_mean_fn",",","except","it","is","called","for","sigma","points","which","form","the","measurements","after","being","passed","through","hx","(",")",".","residual_x",":","callable","(","x",",","y",")",",","optional","residual_z",":","callable","(","x",",","y",")",",","optional","Function","that","computes","the","residual","(","difference",")","between","x","and","y",".","You","will","have","to","supply","this","if","your","state","variable","can","not","support","subtraction",",","such","as","angles","(","359-1","degreees","is","2",",","not","358",")",".","x","and","y","are","state","vectors",",","not","scalars",".","One","is","for","the","state","variable",",","the","other","is","for","the","measurement","state",".","..","code-block",":",":","Python","def","residual","(","a",",","b",")",":","y","=","a","[","0","]","-","b","[","0","]","if","y",">","np.pi",":","y","-=","2","*","np.pi","if","y","<","-np.pi",":","y","=","2","*","np.pi","return","y","Attributes","--","--","--","--","--","x",":","numpy.array","(","dim_x",")","state","estimate","vector","P",":","numpy.array","(","dim_x",",","dim_x",")","covariance","estimate","matrix","x_prior",":","numpy.array","(","dim_x",",","1",")","Prior","(","predicted",")","state","estimate",".","The","*","_prior","and","*","_post","attributes","are","for","convienence",";","they","store","the","prior","and","posterior","of","the","current","epoch",".","Read","Only",".","P_prior",":","numpy.array","(","dim_x",",","dim_x",")","Prior","(","predicted",")","state","covariance","matrix",".","Read","Only",".","x_post",":","numpy.array","(","dim_x",",","1",")","Posterior","(","updated",")","state","estimate",".","Read","Only",".","P_post",":","numpy.array","(","dim_x",",","dim_x",")","Posterior","(","updated",")","state","covariance","matrix",".","Read","Only","R",":","numpy.array","(","dim_z",",","dim_z",")","measurement","noise","matrix","Q",":","numpy.array","(","dim_x",",","dim_x",")","process","noise","matrix","K",":","numpy.array","Kalman","gain",".","Read","only",".","y",":","numpy.array","innovation","residual",".","Read","only",".","z",":","ndarray","Last","measurement","used","in","update","(",")",".","Read","only",".","log_likelihood",":","float","log-likelihood","of","the","last","measurement",".","Read","only",".","likelihood",":","float","likelihood","of","last","measurment",".","Read","only",".","Computed","from","the","log-likelihood",".","The","log-likelihood","can","be","very","small",",","meaning","a","large","negative","value","such","as","-28000",".","Taking","the","exp","(",")","of","that","results","in","0.0",",","which","can","break","typical","algorithms","which","multiply","by","this","value",",","so","by","default","we","always","return","a","number",">","=","sys.float_info.min",".","mahalanobis",":","float","mahalanobis","distance","of","the","innovation",".","Read","only",".","References","--","--","--","--","--","..","[","1","]","Arasaratnam",",","I",",","Haykin",",","S.","``","Cubature","Kalman","Filters",",","''","IEEE","Transactions","on","Automatic","Control",",","2009",",","pp","1254-1269",",","vol","54",",","No","6"]
code: def __repr__(self):
      return "\n".join(
          [
              "CubatureKalmanFilter object",
              pretty_str("dim_x", self.dim_x),
              pretty_str("dim_z", self.dim_z),
              pretty_str("dt", self._dt),
              pretty_str("x", self.x),
              pretty_str("P", self.P),
              pretty_str("Q", self.Q),
              pretty_str("R", self.R),
              pretty_str("K", self.K),
              pretty_str("y", self.y),
              pretty_str("log-likelihood", self.log_likelihood),
              pretty_str("likelihood", self.likelihood),
              pretty_str("mahalanobis", self.mahalanobis),
          ]
      )
  
file_path: filterpy/filterpy/kalman/CubatureKalmanFilter.py
imports: from __future__ import absolute_import, division
  from copy import deepcopy
  from math import log, exp, sqrt
  import sys
  import numpy
  from numpy import eye, zeros, dot, isscalar
  from scipy.linalg import inv, cholesky
  from filterpy.stats import logpdf
  from filterpy.common import pretty_str, outer_product_sum
label_desc: Use image node_id 7 for calling the CubatureKalmanFilter obj's underlying member method code with example usage: obj.__repr__() and returns: str