Great submission, thanks!
One question though: in the parameter explanation you define inputs x and P as "a priori" state estimate and "a priori" estimated state covariance. In my understanding this is not right, as "a priori" values are only available right after the prediction step of the filter.
So, in my opinion x and P are the "a posteriori" values of the previous time step. The "a priori" values of x and P of the current time step are available after the prediction step of your filter (vals x1 and P in lines 51 and 52).
Do you agree?