Skip to content

[codex] Fix hypertoroidal nonadditive particle prediction#1857

Merged
FlorianPfaff merged 3 commits intomainfrom
codex/fix-hypertoroidal-nonadditive
Apr 25, 2026
Merged

[codex] Fix hypertoroidal nonadditive particle prediction#1857
FlorianPfaff merged 3 commits intomainfrom
codex/fix-hypertoroidal-nonadditive

Conversation

@FlorianPfaff
Copy link
Copy Markdown
Owner

Summary

Fix HypertoroidalParticleFilter.predict_nonlinear_nonadditive so it reuses the base particle-filter nonadditive prediction logic and then wraps particles back onto the torus with mod(..., 2*pi).

This avoids treating filter_state as if it were a raw particle array. filter_state is a HypertoroidalDiracDistribution; the raw particles live in filter_state.d.

Root Cause

The hypertoroidal override used self.filter_state.shape, zeros_like(self.filter_state), and self.filter_state[i, :], which are array operations on a distribution object. Its input validation also compared the full samples.shape tuple to weights.size, rejecting valid (n_samples, dim) noise samples.

Tests

Added a regression test in tests/filters/test_hypertoroidal_particle_filter.py that calls predict_nonlinear_nonadditive, checks the particle shape is preserved, and verifies the resulting angular particles remain in [0, 2*pi).

Not run locally because this Codex workspace is read-only and the change was applied through the GitHub connector. The repository's PR CI should run the backend matrix.

@github-actions
Copy link
Copy Markdown
Contributor

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 18.3s
✅ JSON prettier 2 0 0 0 0.46s
✅ JSON v8r 2 0 0 2.55s
✅ MARKDOWN markdownlint 2 0 0 0 0.78s
✅ MARKDOWN markdown-table-formatter 2 0 0 0 0.32s
✅ PYTHON bandit 382 0 0 5.79s
✅ PYTHON black 382 1 0 0 8.74s
✅ PYTHON flake8 382 0 0 3.27s
✅ PYTHON isort 382 2 0 0 0.73s
✅ PYTHON mypy 382 0 0 5.22s
✅ PYTHON pylint 382 0 0 117.64s
✅ PYTHON ruff 382 2 0 0 0.07s
✅ REPOSITORY checkov yes no no 23.3s
✅ REPOSITORY gitleaks yes no no 10.87s
✅ REPOSITORY git_diff yes no no 0.02s
✅ REPOSITORY secretlint yes no no 6.67s
✅ REPOSITORY syft yes no no 3.19s
✅ REPOSITORY trivy-sbom yes no no 2.22s
✅ REPOSITORY trufflehog yes no no 21.41s
✅ YAML prettier 4 0 0 0 0.48s
✅ YAML v8r 4 0 0 5.19s
✅ YAML yamllint 4 0 0 0.49s

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.4.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_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 FlorianPfaff marked this pull request as ready for review April 25, 2026 09:08
@github-actions
Copy link
Copy Markdown
Contributor

Test Results

    12 files  ± 0      12 suites  ±0   4h 41m 44s ⏱️ - 5m 16s
 1 091 tests + 1   1 091 ✅ +1      0 💤 ±0  0 ❌ ±0 
13 376 runs  +12  10 280 ✅ +8  3 096 💤 +4  0 ❌ ±0 

Results for commit cde6b43. ± Comparison against base commit f344bab.

@FlorianPfaff FlorianPfaff merged commit 9df5f04 into main Apr 25, 2026
19 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.

1 participant