def update(self, z):
        """ update the filter with measurement z. z must be the same type
        (or treatable as the same type) as self.x[0].
        """

        if self.order == 0:
            G = 1 - self.beta
            self.x = self.x + dot(G,(z-self.x))

        elif self.order == 1:
            G = 1 - self.beta**2
            H = (1-self.beta)**2
            x = self.x[0]
            dx = self.x[1]
            dxdt = dot(dx, self.dt)

            residual = z - (x+dxdt)
            self.x[0] = x + dxdt + G*residual
            self.x[1] = dx + (H / self.dt)*residual
            #print(self.x)

        else: # order == 2
            G = 1-self.beta**3
            H = 1.5*(1+self.beta)*(1-self.beta)**2
            K = 0.5*(self.beta-1)**3

            x = self.x[0]
            dx = self.x[1]
            ddx = self.x[2]
            dxdt = dot(dx, self.dt)
            T2 = self.dt**2.

            residual = z -(x + dxdt +0.5*ddx*T2)

            self.x[0] = x + dxdt + 0.5*ddx*T2 + G*residual
            self.x[1] = dx + ddx*self.dt + (H/self.dt)*residual
            self.x[2] = ddx + (2*K/(self.dt**2))*residual
dataset/ETHPy150Open rlabbe/filterpy/filterpy/memory/fading_memory.py/FadingMemoryFilter.update/swapped operands of `-`