Skip to content

Add RB-FFBSi smoother for MEM-RBPF trackers#2071

Merged
FlorianPfaff merged 6 commits into
mainfrom
codex/add-rbpf-sm2
May 17, 2026
Merged

Add RB-FFBSi smoother for MEM-RBPF trackers#2071
FlorianPfaff merged 6 commits into
mainfrom
codex/add-rbpf-sm2

Conversation

@FlorianPfaff
Copy link
Copy Markdown
Owner

Summary

This PR adds a PyRecEst-native fixed-interval Rao-Blackwellized FFBSi smoother for MEMRBPFTracker forward passes.

It includes:

  • MEMRBPFForwardRecord: detached weighted filtering records for MEM-RBPF scans.
  • RBFFBSiResult: structured smoother output with point estimates, kinematic RTS results, backward-sampled particle trajectories, and sample states.
  • MEMRBPFFFBSiSmoother: fixed-interval RB-FFBSi smoother.
  • aliases MEMRBPF_FFBSiSmoother and RBFFBSiSmoother.
  • exports in pyrecest.smoothers.
  • focused tests for deterministic smoothing, stochastic shape/trajectory outputs, mapping records, aliases, and tracker snapshot construction.

Why

The MEM-RBPF tracker already has a Rao-Blackwellized filtering structure: a shared Gaussian kinematic state, orientation particles, and conditional Gaussian semi-axis states. FFBSi is a natural offline smoother for this representation.

The reproduction repository had an FFBSi smoother implemented as a local tracker subclass. This PR instead adds a reusable smoother API around explicit forward records, so applications can either collect records manually or build them from MEMRBPFTracker instances.

Main implementation choices

  • The smoother consumes explicit MEMRBPFForwardRecord objects rather than owning the forward filtering loop.
  • MEMRBPFForwardRecord.from_tracker(tracker) supports a future tracker.get_filtering_state(...) hook when available, and otherwise falls back to current tracker arrays.
  • The kinematic state is smoothed once with a standard RTS recursion.
  • Orientation trajectories are sampled backward using wrapped-normal transition densities.
  • Conditional semi-axis trajectories use the linear-Gaussian backward kernel.
  • Point estimates are formed from the backward samples by averaging ellipse extent matrices and eigendecomposing the mean extent.
  • Output states use full axis lengths by default, matching MEMRBPFTracker.get_state(full_axis_lengths=True), but the smoother supports semi-axis output with full_axis_lengths=False.

Files changed

  • src/pyrecest/smoothers/mem_rbpf_ffbsi_smoother.py
  • src/pyrecest/smoothers/__init__.py
  • tests/smoothers/test_mem_rbpf_ffbsi_smoother.py

Tests included

The tests cover:

  • smoother aliases;
  • deterministic two-record RTS and axis backward-kernel behavior;
  • finite outputs for multiple particles;
  • MEMRBPFForwardRecord.from_tracker(...) after a tracker update;
  • mapping-record inputs.

Suggested validation

python -m pytest tests/smoothers/test_mem_rbpf_ffbsi_smoother.py

Syntax validation performed while drafting:

python -m py_compile \
  src/pyrecest/smoothers/mem_rbpf_ffbsi_smoother.py \
  tests/smoothers/test_mem_rbpf_ffbsi_smoother.py

Notes

This intentionally does not port the reproduction repository's MEMRBPF_FFBSi tracker subclass as-is. The upstream version separates recording from smoothing and exposes a reusable smoother API around explicit forward records.

The branch was created from a recent main, but main moved while this was being pushed. The changes are additive except for smoothers/__init__.py, so rebasing should be straightforward if GitHub reports the branch as behind.

@FlorianPfaff FlorianPfaff enabled auto-merge (squash) May 17, 2026 16:05
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 17, 2026

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 21.11s
✅ JSON prettier 2 0 0 0 0.48s
✅ JSON v8r 2 0 0 2.96s
✅ MARKDOWN markdownlint 28 0 0 0 1.36s
✅ MARKDOWN markdown-table-formatter 28 0 0 0 0.35s
✅ PYTHON bandit 560 0 0 9.69s
✅ PYTHON black 560 4 0 0 16.77s
✅ PYTHON flake8 560 0 0 5.99s
✅ PYTHON isort 560 6 0 0 1.05s
✅ PYTHON mypy 560 0 0 7.5s
✅ PYTHON pylint 560 0 0 101.72s
✅ PYTHON ruff 560 6 0 0 0.11s
✅ REPOSITORY checkov yes no no 30.71s
✅ REPOSITORY gitleaks yes no no 13.93s
✅ REPOSITORY git_diff yes no no 0.04s
✅ REPOSITORY osv-scanner yes no no 0.89s
✅ REPOSITORY secretlint yes no no 9.86s
✅ REPOSITORY syft yes no no 3.53s
✅ REPOSITORY trivy-sbom yes no no 4.0s
✅ REPOSITORY trufflehog yes no no 22.63s
✅ YAML prettier 5 0 0 0 0.53s
✅ YAML v8r 5 0 0 5.61s
✅ YAML yamllint 5 0 0 0.53s

Notices

📣 MegaLinter 9.5.0 is out! Discover the new features and security recommendations in the release announcement. (Skip this info by defining SECURITY_SUGGESTIONS: false)

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 FLAVOR_SUGGESTIONS: false)

  • Documentation: Custom Flavors
  • Command: npx mega-linter-runner@9.5.0 --custom-flavor-setup --custom-flavor-linters PYTHON_PYLINT,PYTHON_BLACK,PYTHON_FLAKE8,PYTHON_ISORT,PYTHON_BANDIT,PYTHON_MYPY,PYTHON_RUFF,COPYPASTE_JSCPD,JSON_V8R,JSON_PRETTIER,MARKDOWN_MARKDOWNLINT,MARKDOWN_MARKDOWN_TABLE_FORMATTER,REPOSITORY_CHECKOV,REPOSITORY_GIT_DIFF,REPOSITORY_GITLEAKS,REPOSITORY_OSV_SCANNER,REPOSITORY_SECRETLINT,REPOSITORY_SYFT,REPOSITORY_TRIVY_SBOM,REPOSITORY_TRUFFLEHOG,YAML_PRETTIER,YAML_YAMLLINT,YAML_V8R

MegaLinter is graciously provided by OX Security
Show us your support by starring ⭐ the repository

@FlorianPfaff
Copy link
Copy Markdown
Owner Author

@copilot Fix megalinter issues

auto-merge was automatically disabled May 17, 2026 16:21

Head branch was pushed to by a user without write access

Copy link
Copy Markdown
Contributor

Copilot AI commented May 17, 2026

@copilot Fix megalinter issues

Fixed the MegaLinter issue by updating the IDKF typing in information_form_distributed_kalman_filter.py (mypy-related) and pushed commit 3c9d3dd.

@FlorianPfaff FlorianPfaff enabled auto-merge (squash) May 17, 2026 16:23
@FlorianPfaff FlorianPfaff disabled auto-merge May 17, 2026 16:28
@FlorianPfaff FlorianPfaff merged commit 4d4bf09 into main May 17, 2026
18 checks 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.

2 participants