class_docstr: Generates sigma points and weights according to Van der Merwe's
  2004 dissertation[1] for the UnscentedKalmanFilter class.. It
  parametizes the sigma points using alpha, beta, kappa terms, and
  is the version seen in most publications.
  
  Unless you know better, this should be your default choice.
  
  Parameters
  ----------
  
  n : int
      Dimensionality of the state. 2n+1 weights will be generated.
  
  alpha : float
      Determins the spread of the sigma points around the mean.
      Usually a small positive value (1e-3) according to [3].
  
  beta : float
      Incorporates prior knowledge of the distribution of the mean. For
      Gaussian x beta=2 is optimal, according to [3].
  
  kappa : float, default=0.0
      Secondary scaling parameter usually set to 0 according to [4],
      or to 3-n according to [5].
  
  sqrt_method : function(ndarray), default=scipy.linalg.cholesky
      Defines how we compute the square root of a matrix, which has
      no unique answer. Cholesky is the default choice due to its
      speed. Typically your alternative choice will be
      scipy.linalg.sqrtm. Different choices affect how the sigma points
      are arranged relative to the eigenvectors of the covariance matrix.
      Usually this will not matter to you; if so the default cholesky()
      yields maximal performance. As of van der Merwe's dissertation of
      2004 [6] this was not a well reseached area so I have no advice
      to give you.
  
      If your method returns a triangular matrix it must be upper
      triangular. Do not use numpy.linalg.cholesky - for historical
      reasons it returns a lower triangular matrix. The SciPy version
      does the right thing.
  
  subtract : callable (x, y), optional
      Function that computes the 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.
  
  Attributes
  ----------
  
  Wm : np.array
      weight for each sigma point for the mean
  
  Wc : np.array
      weight for each sigma point for the covariance
  
  Examples
  --------
  
  See my book Kalman and Bayesian Filters in Python
  https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python
  
  
  References
  ----------
  
  .. [1] R. Van der Merwe "Sigma-Point Kalman Filters for Probabilitic
         Inference in Dynamic State-Space Models" (Doctoral dissertation)
class_docstr_tok: ["Generates","sigma","points","and","weights","according","to","Van","der","Merwe's","2004","dissertation","[","1","]","for","the","UnscentedKalmanFilter","class","..","It","parametizes","the","sigma","points","using","alpha",",","beta",",","kappa","terms",",","and","is","the","version","seen","in","most","publications",".","Unless","you","know","better",",","this","should","be","your","default","choice",".","Parameters","--","--","--","--","--","n",":","int","Dimensionality","of","the","state",".","2n+1","weights","will","be","generated",".","alpha",":","float","Determins","the","spread","of","the","sigma","points","around","the","mean",".","Usually","a","small","positive","value","(","1e-3",")","according","to","[","3","]",".","beta",":","float","Incorporates","prior","knowledge","of","the","distribution","of","the","mean",".","For","Gaussian","x","beta=2","is","optimal",",","according","to","[","3","]",".","kappa",":","float",",","default=0.0","Secondary","scaling","parameter","usually","set","to","0","according","to","[","4","]",",","or","to","3-n","according","to","[","5","]",".","sqrt_method",":","function","(","ndarray",")",",","default=scipy.linalg.cholesky","Defines","how","we","compute","the","square","root","of","a","matrix",",","which","has","no","unique","answer",".","Cholesky","is","the","default","choice","due","to","its","speed",".","Typically","your","alternative","choice","will","be","scipy.linalg.sqrtm",".","Different","choices","affect","how","the","sigma","points","are","arranged","relative","to","the","eigenvectors","of","the","covariance","matrix",".","Usually","this","will","not","matter","to","you",";","if","so","the","default","cholesky","(",")","yields","maximal","performance",".","As","of","van","der","Merwe","'s","dissertation","of","2004","[","6","]","this","was","not","a","well","reseached","area","so","I","have","no","advice","to","give","you",".","If","your","method","returns","a","triangular","matrix","it","must","be","upper","triangular",".","Do","not","use","numpy.linalg.cholesky","-","for","historical","reasons","it","returns","a","lower","triangular","matrix",".","The","SciPy","version","does","the","right","thing",".","subtract",":","callable","(","x",",","y",")",",","optional","Function","that","computes","the","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",".","Attributes","--","--","--","--","--","Wm",":","np.array","weight","for","each","sigma","point","for","the","mean","Wc",":","np.array","weight","for","each","sigma","point","for","the","covariance","Examples","--","--","--","--","See","my","book","Kalman","and","Bayesian","Filters","in","Python","https",":","\/\/github.com\/rlabbe\/Kalman-and-Bayesian-Filters-in-Python","References","--","--","--","--","--","..","[","1","]","R.","Van","der","Merwe","``","Sigma-Point","Kalman","Filters","for","Probabilitic","Inference","in","Dynamic","State-Space","Models","''","(","Doctoral","dissertation",")"]
docstr: Computes the sigma points for an unscented Kalman filter
  given the mean (x) and covariance(P) of the filter.
  Returns tuple of the sigma points and weights.
  
  Works with both scalar and array inputs:
  sigma_points (5, 9, 2) # mean 5, covariance 9
  sigma_points ([5, 2], 9*eye(2), 2) # means 5 and 2, covariance 9I
  
  Parameters
  ----------
  
  x : An array-like object of the means of length n
      Can be a scalar if 1D.
      examples: 1, [1,2], np.array([1,2])
  
  P : scalar, or np.array
     Covariance of the filter. If scalar, is treated as eye(n)*P.
  
  Returns
  -------
  
  sigmas : np.array, of size (2n+1, n)
      Two dimensional array of sigma points. Each column contains all of
      the sigmas for one dimension in the problem space.
  
      Ordered by Xi_0, Xi_{1..n}, Xi_{n+1..2n}
docstr_tok: ["Computes","the","sigma","points","for","an","unscented","Kalman","filter","given","the","mean","(","x",")","and","covariance","(","P",")","of","the","filter",".","Returns","tuple","of","the","sigma","points","and","weights",".","Works","with","both","scalar","and","array","inputs",":","sigma_points","(","5",",","9",",","2",")","#","mean","5",",","covariance","9","sigma_points","(","[","5",",","2","]",",","9","*","eye","(","2",")",",","2",")","#","means","5","and","2",",","covariance","9I","Parameters","--","--","--","--","--","x",":","An","array-like","object","of","the","means","of","length","n","Can","be","a","scalar","if","1D",".","examples",":","1",",","[","1,2","]",",","np.array","(","[","1,2","]",")","P",":","scalar",",","or","np.array","Covariance","of","the","filter",".","If","scalar",",","is","treated","as","eye","(","n",")","*","P.","Returns","--","--","--","-","sigmas",":","np.array",",","of","size","(","2n+1",",","n",")","Two","dimensional","array","of","sigma","points",".","Each","column","contains","all","of","the","sigmas","for","one","dimension","in","the","problem","space",".","Ordered","by","Xi_0",",","Xi_","{","1","..","n","}",",","Xi_","{","n+1","..","2n","}"]
code: def sigma_points(self, x, P):
      """Computes the sigma points for an unscented Kalman filter
      given the mean (x) and covariance(P) of the filter.
      Returns tuple of the sigma points and weights.
  
      Works with both scalar and array inputs:
      sigma_points (5, 9, 2) # mean 5, covariance 9
      sigma_points ([5, 2], 9*eye(2), 2) # means 5 and 2, covariance 9I
  
      Parameters
      ----------
  
      x : An array-like object of the means of length n
          Can be a scalar if 1D.
          examples: 1, [1,2], np.array([1,2])
  
      P : scalar, or np.array
         Covariance of the filter. If scalar, is treated as eye(n)*P.
  
      Returns
      -------
  
      sigmas : np.array, of size (2n+1, n)
          Two dimensional array of sigma points. Each column contains all of
          the sigmas for one dimension in the problem space.
  
          Ordered by Xi_0, Xi_{1..n}, Xi_{n+1..2n}
      """
  
      if self.n != np.size(x):
          raise ValueError(
              "expected size(x) {}, but size is {}".format(
                  self.n, np.size(x)
              )
          )
  
      n = self.n
  
      if np.isscalar(x):
          x = np.asarray([x])
  
      if np.isscalar(P):
          P = np.eye(n) * P
      else:
          P = np.atleast_2d(P)
  
      lambda_ = self.alpha**2 * (n + self.kappa) - n
      U = self.sqrt((lambda_ + n) * P)
  
      sigmas = np.zeros((2 * n + 1, n))
      sigmas[0] = x
      for k in range(n):
          # pylint: disable=bad-whitespace
          sigmas[k + 1] = self.subtract(x, -U[k])
          sigmas[n + k + 1] = self.subtract(x, U[k])
  
      return sigmas
  
imports: from __future__ import division
  import numpy
  from scipy.linalg import cholesky
  from filterpy.common import pretty_str
label_desc: Use image node_id 3 for calling the MerweScaledSigmaPoints obj's underlying member method code with example usage: obj.sigma_points(x, P) and returns: sigmas