Skip to content

Feature/toroidal vm matrix#1761

Open
FlorianPfaff wants to merge 6 commits intomainfrom
feature/toroidal_vm_matrix
Open

Feature/toroidal vm matrix#1761
FlorianPfaff wants to merge 6 commits intomainfrom
feature/toroidal_vm_matrix

Conversation

@FlorianPfaff
Copy link
Copy Markdown
Owner

No description provided.

FlorianPfaff and others added 2 commits March 28, 2026 05:12
…1758)

* Port ToroidalVonMisesMatrixDistribution from MATLAB: fix normalization, n=8 formula, add missing methods, fix tests

Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/5028dcbd-cd94-4f63-a346-97cab6f3f688

Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>

* Changes before error encountered

Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/fc95a469-0e91-413a-880a-ba337e46e637

Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>

* Replace numpy with pyrecest.backend in test file per review feedback

Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/b98ad933-c22e-4219-bf3b-f96e24dfefc3

Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>

* Add comment clarifying pre-normalized weights usage in test

Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/b98ad933-c22e-4219-bf3b-f96e24dfefc3

Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>
@FlorianPfaff
Copy link
Copy Markdown
Owner Author

@copilot resolve the merge conflicts in this pull request

1 similar comment
@FlorianPfaff
Copy link
Copy Markdown
Owner Author

@copilot resolve the merge conflicts in this pull request

Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 20, 2026

@copilot resolve the merge conflicts in this pull request

Resolved the merge conflicts in commit 209b43e. The only conflict was in pyrecest/distributions/hypertorus/toroidal_fourier_distribution.py — the feature branch had a simple alias while main introduced a full ToroidalFourierDistribution class. I kept the full class from main.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 20, 2026

MegaLinter analysis: Error

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 14.8s
✅ JSON prettier 2 0 0 0 0.73s
✅ JSON v8r 2 0 0 2.33s
✅ MARKDOWN markdownlint 2 0 0 0 0.69s
✅ MARKDOWN markdown-table-formatter 2 0 0 0 0.27s
✅ PYTHON bandit 346 0 0 5.44s
✅ PYTHON black 346 7 0 0 10.97s
❌ PYTHON flake8 346 1 0 3.06s
✅ PYTHON isort 346 8 0 0 0.69s
✅ PYTHON mypy 346 0 0 5.01s
❌ PYTHON pylint 346 2 0 110.59s
✅ PYTHON ruff 346 8 0 0 0.07s
✅ REPOSITORY checkov yes no no 23.41s
✅ REPOSITORY gitleaks yes no no 6.49s
✅ REPOSITORY git_diff yes no no 0.05s
✅ REPOSITORY secretlint yes no no 6.76s
✅ REPOSITORY syft yes no no 6.35s
✅ REPOSITORY trivy-sbom yes no no 2.07s
✅ REPOSITORY trufflehog yes no no 19.21s
✅ YAML prettier 4 0 0 0 0.44s
✅ YAML v8r 4 0 0 5.57s
✅ YAML yamllint 4 0 0 0.42s

Detailed Issues

❌ PYTHON / flake8 - 1 error
pyrecest/tests/distributions/test_toroidal_von_mises_matrix_distribution.py:69:32: E203 whitespace before ':'
❌ PYTHON / pylint - 2 errors
************* Module update_init_helper
update_init_helper.py:1:0: R0801: Similar lines in 2 files
==pyrecest.distributions.hypertorus.toroidal_vm_matrix_distribution:[37:44]
==pyrecest.distributions.hypertorus.toroidal_von_mises_matrix_distribution:[49:55]
        AbstractToroidalDistribution.__init__(self)
        assert mu.shape == (2,)
        assert kappa.shape == (2,)
        assert A.shape == (2, 2)
        assert kappa[0] > 0
        assert kappa[1] > 0
 (duplicate-code)
update_init_helper.py:1:0: R0801: Similar lines in 2 files
==pyrecest.distributions.hypertorus.toroidal_vm_matrix_distribution:[79:85]
==pyrecest.distributions.hypertorus.toroidal_von_mises_matrix_distribution:[77:84]
        a11 = self.A[0, 0]
        a12 = self.A[0, 1]
        a21 = self.A[1, 0]
        a22 = self.A[1, 1]
        k1 = self.kappa[0]
        k2 = self.kappa[1]
 (duplicate-code)

------------------------------------
Your code has been rated at 10.00/10

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

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 20, 2026

Test Results

    12 files  ± 0     12 suites  ±0   4h 21m 49s ⏱️ + 3m 26s
   992 tests + 7    992 ✅ + 7      0 💤 ± 0  0 ❌ ±0 
12 188 runs  +84  9 400 ✅ +28  2 788 💤 +56  0 ❌ ±0 

Results for commit 844f3eb. ± Comparison against base commit 224177b.

♻️ This comment has been updated with latest results.

@FlorianPfaff
Copy link
Copy Markdown
Owner Author

@copilot Use skipif so that the test cases aren't executed for the jax backend

=========================== short test summary info ============================
FAILED pyrecest/tests/distributions/test_toroidal_von_mises_matrix_distribution.py::ToroidalVMMatrixDistributionTest::test_compare_with_ToroidalFourier_multiplication - AssertionError: Only supported for numpy backend
FAILED pyrecest/tests/distributions/test_toroidal_von_mises_matrix_distribution.py::ToroidalVMMatrixDistributionTest::test_integral - AssertionError: Only supported for numpy backend
FAILED pyrecest/tests/distributions/test_toroidal_von_mises_matrix_distribution.py::ToroidalVMMatrixDistributionTest::test_multiply - AssertionError: Only supported for numpy backend
FAILED pyrecest/tests/distributions/test_toroidal_von_mises_matrix_distribution.py::ToroidalVMMatrixDistributionTest::test_pdf - AssertionError: Only supported for numpy backend
FAILED pyrecest/tests/distributions/test_toroidal_von_mises_matrix_distribution.py::ToroidalVMMatrixDistributionTest::test_product_approximation - AssertionError: Only supported for numpy backend
FAILED pyrecest/tests/distributions/test_toroidal_von_mises_matrix_distribution.py::ToroidalVMMatrixDistributionTest::test_sanity_check - AssertionError: Only supported for numpy backend
FAILED pyrecest/tests/distributions/test_toroidal_von_mises_matrix_distribution.py::ToroidalVMMatrixDistributionTest::test_trig_moment_numerical - AssertionError: Only supported for numpy backend

…ion tests

Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/8925327c-bd2e-4d5c-a7fe-9de1fc640973

Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 20, 2026

@copilot Use skipif so that the test cases aren't executed for the jax backend

=========================== short test summary info ============================
...

Added @unittest.skipIf(pyrecest.backend.__backend_name__ == "jax", reason="Not supported for jax backend") to all 7 test methods in test_toroidal_von_mises_matrix_distribution.py in commit f82f846.

@FlorianPfaff
Copy link
Copy Markdown
Owner Author

@copilot Can you use skipif to skip the respective tests? See also other test files.

=========================== short test summary info ============================
FAILED pyrecest/tests/distributions/test_toroidal_von_mises_matrix_distribution.py::ToroidalVMMatrixDistributionTest::test_compare_with_ToroidalFourier_multiplication - AssertionError: Only supported for numpy backend
FAILED pyrecest/tests/distributions/test_toroidal_von_mises_matrix_distribution.py::ToroidalVMMatrixDistributionTest::test_integral - AssertionError: Only supported for numpy backend
FAILED pyrecest/tests/distributions/test_toroidal_von_mises_matrix_distribution.py::ToroidalVMMatrixDistributionTest::test_multiply - AssertionError: Only supported for numpy backend
FAILED pyrecest/tests/distributions/test_toroidal_von_mises_matrix_distribution.py::ToroidalVMMatrixDistributionTest::test_pdf - AssertionError: Only supported for numpy backend
FAILED pyrecest/tests/distributions/test_toroidal_von_mises_matrix_distribution.py::ToroidalVMMatrixDistributionTest::test_product_approximation - AssertionError: Only supported for numpy backend
FAILED pyrecest/tests/distributions/test_toroidal_von_mises_matrix_distribution.py::ToroidalVMMatrixDistributionTest::test_sanity_check - AssertionError: Only supported for numpy backend
FAILED pyrecest/tests/distributions/test_toroidal_von_mises_matrix_distribution.py::ToroidalVMMatrixDistributionTest::test_trig_moment_numerical - AssertionError: Only supported for numpy backend

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 20, 2026

@copilot Can you use skipif to skip the respective tests? See also other test files.

=========================== short test summary info ============================
...

The CI failures were happening on the pytorch backend too (not just jax). Updated all 7 @unittest.skipIf decorators to skip for both "jax" and "pytorch" backends in commit 86d137f.

@FlorianPfaff
Copy link
Copy Markdown
Owner Author

@copilot Suppress the too-many-locals and no-member, fix the rest.

❌ PYTHON / flake8 - 2 errors
pyrecest/tests/distributions/test_toroidal_von_mises_matrix_distribution.py:8:1: F401 'pyrecest.backend.squeeze' imported but unused
pyrecest/tests/distributions/test_toroidal_von_mises_matrix_distribution.py:65:32: E203 whitespace before ':'
❌ PYTHON / pylint - 17 errors
************* Module pyrecest.distributions.hypertorus.toroidal_von_mises_matrix_distribution
pyrecest/distributions/hypertorus/toroidal_von_mises_matrix_distribution.py:424:15: R1714: Consider merging these comparisons with 'in' by using 'dimension in (1, 2)'. Use a set instead if elements are hashable. (consider-using-in)
pyrecest/distributions/hypertorus/toroidal_von_mises_matrix_distribution.py:444:4: W0237: Parameter 'shift_by' has been renamed to 'shift_angles' in overriding 'ToroidalVonMisesMatrixDistribution.shift' method (arguments-renamed)
************* Module pyrecest.tests.distributions.test_toroidal_von_mises_matrix_distribution
pyrecest/tests/distributions/test_toroidal_von_mises_matrix_distribution.py:8:0: W0622: Redefining built-in 'sum' (redefined-builtin)
pyrecest/tests/distributions/test_toroidal_von_mises_matrix_distribution.py:5:0: E0611: No name 'i0' in module 'scipy.special' (no-name-in-module)
pyrecest/tests/distributions/test_toroidal_von_mises_matrix_distribution.py:5:0: E0611: No name 'i1' in module 'scipy.special' (no-name-in-module)
pyrecest/tests/distributions/test_toroidal_von_mises_matrix_distribution.py:41:8: E1101: Module 'pyrecest' has no 'backend' member (no-member)
pyrecest/tests/distributions/test_toroidal_von_mises_matrix_distribution.py:51:8: E1101: Module 'pyrecest' has no 'backend' member (no-member)
pyrecest/tests/distributions/test_toroidal_von_mises_matrix_distribution.py:71:8: E1101: Module 'pyrecest' has no 'backend' member (no-member)
pyrecest/tests/distributions/test_toroidal_von_mises_matrix_distribution.py:78:8: E1101: Module 'pyrecest' has no 'backend' member (no-member)
pyrecest/tests/distributions/test_toroidal_von_mises_matrix_distribution.py:85:8: E1101: Module 'pyrecest' has no 'backend' member (no-member)
pyrecest/tests/distributions/test_toroidal_von_mises_matrix_distribution.py:97:8: E1101: Module 'pyrecest' has no 'backend' member (no-member)
pyrecest/tests/distributions/test_toroidal_von_mises_matrix_distribution.py:121:4: R0914: Too many local variables (20/15) (too-many-locals)
pyrecest/tests/distributions/test_toroidal_von_mises_matrix_distribution.py:118:8: E1101: Module 'pyrecest' has no 'backend' member (no-member)
pyrecest/tests/distributions/test_toroidal_von_mises_matrix_distribution.py:150:74: W0640: Cell variable r defined in loop (cell-var-from-loop)
pyrecest/tests/distributions/test_toroidal_von_mises_matrix_distribution.py:8:0: W0611: Unused squeeze imported from pyrecest.backend (unused-import)
************* Module update_init_helper

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 21, 2026

@copilot Suppress the too-many-locals and no-member, fix the rest.

❌ PYTHON / flake8 - 2 errors
...

Fixed all issues in commit 844f3eb:

  • Suppressed no-member (inline # pylint: disable=no-member on __backend_name__ lines) and too-many-locals (on test_product_approximation)
  • Fixed: removed unused squeeze import, renamed sumbackend_sum to avoid redefining builtin, added # pylint: disable=no-name-in-module for scipy.special imports, fixed cell-var-from-loop with lambda k, r=r:, changed dimension == 1 or dimension == 2dimension in (1, 2), and renamed shift_anglesshift_by to match the parent class signature

@FlorianPfaff FlorianPfaff force-pushed the main branch 3 times, most recently from 7b21428 to 429a157 Compare April 21, 2026 13:50
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