Reject broadcast process covariance in UKF prediction - #5194
Reject broadcast process covariance in UKF prediction#5194FlorianPfaff wants to merge 2 commits into
Conversation
✅MegaLinter analysis: Success
Notices📣 MegaLinter 9.5.0 is out! Discover the new features and security recommendations in the release announcement. (Skip this info by defining See detailed reports in MegaLinter artifacts Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining
|
FlorianPfaff
left a comment
There was a problem hiding this comment.
Closing as superseded by #5253. Both PRs address the same malformed multidimensional UKF process-noise covariance broadcasting bug; #5253 is the refreshed current-main version and explicitly retains the one-dimensional scalar/length-one shorthand plus atomic state preservation. Keeping both open would duplicate review and CI work.

Bug
The low-level unscented Kalman filter added
self.Qdirectly to the predicted covariance without validating its matrix shape.For a two-dimensional state, a vector such as
Q = [0.4, 0.2]was therefore broadcast across the covariance matrix by NumPy. After the existing symmetrization step, an identity prediction silently produced a spurious cross-covariance of0.3instead of rejecting the malformed process-noise input.Fix
Convert the configured process covariance once, require the exact
(dim_x, dim_x)shape, and reuse that validated matrix in the covariance update. Validation happens before filter-state mutation.Regression coverage
The new public regression verifies that a vector-valued process covariance:
ValueError;Validation
python -m py_compilepassed for the modified implementation and regression module;0.3off-diagonal covariance;main;GitHub Actions is the authoritative full backend, lint, packaging, documentation, and integration validation.