I am not sure, I guess I am overlooking something, cf. below where x_hat does not occur. I just noticed this because my editor (PyCharm) notified me about it earlier, but again I might be just overlooking something.
Thanks a lot for helping out here @cluhmann .