8000 Use numpy.linalg.pinv and unwrap unmasked observations in standard filter by M-Colley · Pull Request #226 · pykalman/pykalman · GitHub
[go: up one dir, main page]

Skip to content

Use numpy.linalg.pinv and unwrap unmasked observations in standard filter - #226

Open
M-Colley wants to merge 1 commit into
pykalman:mainfrom
M-Colley:fix/issue-94-masked-array-pinv
Open

M-Colley wants to merge 1 commit into
pykalman:mainfrom
M-Colley:fix/issue-94-masked-array-pinv

Conversation

@M-Colley
@M-Colley M-Colley commented Dec 2, 2026
Copy link
Copy Markdown

Calling KalmanFilter.filter_update() wraps observation with np.ma.asarray(), which previously returned a MaskedArray for next_filtered_state_mean. Passing masked arrays or derived covariances into subsequent updates then raised ValueError: masked arrays are not supported inside scipy.linalg.pinv. Fixes #94.

This change replaces scipy.linalg.pinv calls in pykalman/standard.py with np.linalg.pinv and removes the unused scipy.linalg import. Furthermore, _filter_correct unwraps unmasked observations via np.asarray so unmasked updates return standard numpy.ndarray state estimates. Finally, pykalman/tests/test_standard.py adds the test_filter_update_masked_array regression test.

Verified with python -m pytest pykalman -o addopts= -W default (42 passed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] ValueError: masked arrays are not supported, in plot_em example

1 participant

0