Skip to content

Port Generalized von Mises distribution from libDirectional#1591

Open
Copilot wants to merge 2 commits intomainfrom
copilot/port-generalized-von-moses
Open

Port Generalized von Mises distribution from libDirectional#1591
Copilot wants to merge 2 commits intomainfrom
copilot/port-generalized-von-moses

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 31, 2026

Ports GvMDistribution (arbitrary-order Generalized von Mises) from libDirectional, based on Gatto & Jammalamadaka, Statistical Methodology, 2007.

Distribution

  • PDF: p(x) = (1/C) · exp(Σⱼ κⱼ · cos(j·(x − μⱼ))) for j = 1…k
  • Normalization constant C computed numerically via scipy.integrate.quad and cached
  • Order-1 case is mathematically equivalent to standard von Mises

Changes

  • pyrecest/distributions/circle/generalized_von_mises_distribution.py — new GvMDistribution subclassing AbstractCircularDistribution
  • pyrecest/distributions/__init__.py — exports GvMDistribution
  • pyrecest/tests/distributions/test_generalized_von_mises_distribution.py — covers init validation, PDF non-negativity, integrates-to-1, and order-1 equivalence to VonMisesDistribution
from pyrecest.distributions import GvMDistribution
import numpy as np

# Order-1: equivalent to VonMisesDistribution(mu=2.0, kappa=1.0)
gvm1 = GvMDistribution(np.array([2.0]), np.array([1.0]))

# Order-2: second harmonic with separate location/concentration
gvm2 = GvMDistribution(np.array([2.0, 1.0]), np.array([1.0, 0.5]))
xs = np.linspace(0, 2 * np.pi, 100)
gvm2.pdf(xs)  # normalized, integrates to 1

…libDirectional

Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/93650044-025d-4897-86c3-3ce92e486931

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

github-actions bot commented Mar 31, 2026

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 7.05s
✅ JSON prettier 2 0 0 0 0.46s
✅ JSON v8r 2 0 0 2.47s
✅ MARKDOWN markdownlint 1 0 0 0 0.66s
✅ MARKDOWN markdown-table-formatter 1 0 0 0 0.25s
✅ PYTHON bandit 252 0 0 3.05s
✅ PYTHON black 252 0 0 0 4.42s
✅ PYTHON flake8 252 0 0 1.74s
✅ PYTHON isort 252 2 0 0 0.48s
✅ PYTHON mypy 252 0 0 4.07s
✅ PYTHON pylint 252 0 0 70.96s
✅ PYTHON ruff 252 2 0 0 0.04s
✅ REPOSITORY checkov yes no no 22.3s
✅ REPOSITORY gitleaks yes no no 4.36s
✅ REPOSITORY git_diff yes no no 0.04s
✅ REPOSITORY secretlint yes no no 6.13s
✅ REPOSITORY syft yes no no 3.04s
✅ REPOSITORY trivy-sbom yes no no 2.29s
✅ REPOSITORY trufflehog yes no no 18.28s
✅ YAML prettier 4 0 0 0 0.48s
✅ YAML v8r 4 0 0 4.9s
✅ YAML yamllint 4 0 0 0.42s

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 Mar 31, 2026

Test Results

    4 files   -     8      4 suites   - 8   19m 58s ⏱️ - 2h 58m 30s
  579 tests +    8    579 ✅ +    8  0 💤 ±    0  0 ❌ ±0 
2 464 runs   - 4 600  2 464 ✅  - 3 416  0 💤  - 1 184  0 ❌ ±0 

Results for commit fcbcb16. ± Comparison against base commit 8d19d73.

♻️ This comment has been updated with latest results.

@FlorianPfaff FlorianPfaff force-pushed the copilot/port-generalized-von-moses branch from e5950f9 to fcbcb16 Compare April 1, 2026 15:34
@FlorianPfaff FlorianPfaff enabled auto-merge April 1, 2026 15:34
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