rlabbe / filterpy

Python Kalman filtering and optimal estimation library. Implements Kalman filter, particle filter, Extended Kalman filter, Unscented Kalman filter, g-h (alpha-beta), least squares, H Infinity, smoothers, and more. Has companion book 'Kalman and Bayesian Filters in Python'.
MIT License
3.22k stars 612 forks source link

Revert "Generalized sigma-points" #272

Closed rlabbe closed 2 years ago

rlabbe commented 2 years ago

Reverts rlabbe/filterpy#247

Unit tests are failing.

filterpy/kalman/tests/test_ukf.py::test_generalized_sigma_points_2D_positively_constrained c:\pcloud\filterpy\filterpy\kalman\sigma_points.py:731: RuntimeWarning: divide by zero encountered in truedivide self.s[i] = self.k*np.min(self.x/np.sqrt(self.P)[:, i])


def test_generalized_sigma_points_weights_1D():
    ''' test for Ebeigbe weights (example from paper: III.B)'''

    P, S, K = 0.2, -0.5, 1.3
    sp = GeneralizedSigmaPoints(1, P, S, K)

    Wm, Wc, s = sp.Wm, sp.Wc, sp.s
    assert np.allclose(Wm, Wc, 1e-12)

    ref_w = np.array([0.2, 0.0286, 0.7714])
    ref_s = np.array([0.0, 5.8055, 0.2153])
  assert np.allclose(ref_w, Wm, 1e-4)

E assert False E + where False = <function allclose at 0x00000234893198B0>(array([0.2 , 0.0286, 0.7714]), array([0.2 , 0.02860932, 0.77139068]), 0.0001) E + where <function allclose at 0x00000234893198B0> = np.allclose

tests\test_ukf.py:204: AssertionError