def update(self, z, R_inv=None):
        """
        Add a new measurement (z) to the kalman filter. If z is None, nothing
        is changed.

        Parameters
        ----------

        z : np.array
            measurement for this update.

        R : np.array, scalar, or None
            Optionally provide R to override the measurement noise for this
            one call, otherwise  self.R will be used.
        """

        if z is None:
            return

        if R_inv is None:
            R_inv = self._R_inv
        elif np.isscalar(R_inv):
            R_inv = eye(self.dim_z) * R_inv

        # rename for readability and a tiny extra bit of speed
        H = self._H
        H_T = H.T
        P_inv = self._P_inv
        x = self._x

        if self._no_information:
            self._x = dot(P_inv, x) + dot3(H_T, R_inv, z)
            self._P_inv = P_inv + dot3(H_T, R_inv, H)

        else:       # y = z - Hx
            # error (residual) between measurement and prediction
            self._y = dot(H, x) - z

            # S = HPH' + R
            # project system uncertainty into measurement space
            self._S = P_inv + dot(H_T, R_inv).dot (H)
            self._K = dot3(inv(self._S), H_T, R_inv)

            # x = x + Ky
            # predict new x with residual scaled by the kalman gain
            self._x = x + dot(self._K, self._y)
            self._P_inv = P_inv + dot3(H_T, R_inv, H)
dataset/ETHPy150Open rlabbe/filterpy/filterpy/kalman/information_filter.py/InformationFilter.update/swapped operands of `-`