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.31k stars 617 forks source link

EKF `update` function do not update SI attribute #188

Closed atrabattoni closed 4 years ago

atrabattoni commented 5 years ago

It looks to me that the SI attribut should be updated in the update function in a equal way as in the predict_update function. This is not a big issue but prevents mahalanobis distance measurements.

EKf.py line 235

        self.S = dot(H, PHT) + R
        self.SI = linalg.inv(self.S)
        self.K = dot(PHT, self.SI)

EKf.py line 320

        self.S = dot(H, PHT) + R
        self.K = PHT.dot(linalg.inv(self.S))

EKF.py line 408

            self._mahalanobis = sqrt(float(dot(dot(self.y.T, self.SI), self.y)))
rlabbe commented 4 years ago

This is fixed. Thanks!

nwesem commented 3 years ago

@rlabbe I see that this was fixed in the merge, but it doesn't seem to be in the current version 1.4.5. I think the computation of self.SI needs to be added again to the update function. Maybe it was lost in a later merge..