Port SphericalHarmonicsFilter from MATLAB to Python#1588
Open
Port SphericalHarmonicsFilter from MATLAB to Python#1588
Conversation
…ibution_numerical_fast Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/a02e218a-d9bc-4d03-9c38-8776e308de70 Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>
…scale factor comment Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/a02e218a-d9bc-4d03-9c38-8776e308de70 Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
FlorianPfaff
March 31, 2026 21:22
View session
❌MegaLinter analysis: Error
Detailed Issues❌ PYTHON / flake8 - 8 errors❌ PYTHON / pylint - 20 errors❌ PYTHON / ruff - 7 errorsSee 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
|
Test Results0 tests 0 ✅ 0s ⏱️ Results for commit cead808. ♻️ This comment has been updated with latest results. |
dd20732 to
cead808
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

The
feature/sharmonics_filterbranch contained a stubSphericalHarmonicsFilterand test file but was missing the implementation of the required distribution operations (convolve,multiply,rotate,from_distribution_numerical_fast).Distribution methods added to
SphericalHarmonicsDistributionComplexfrom_distribution_numerical_fast(dist, degree, transformation)— evaluatesdist.pdfon a pyshtools Driscoll-Healy grid and recovers SH coefficients via discrete SHT; replaces the slow integral-based variantconvolve(other)— zonal spherical convolution:identity: direct frequency-domain formulah_{l,m} = √(4π/(2l+1)) · f_{l,m} · g_{l,0}sqrt: grid-based with a 2× finer intermediate grid (avoids aliasing from squaringf²)multiply(other)— grid-based pointwise product; forsqrttransformation√p · √q = √(pq)so no extra step neededrotate(alpha, beta, gamma)— ZYZ Euler-angle rotation viapyshtools.SHCoeffs.rotate(..., body=True)_coeff_mat_to_pysh,_pysh_to_coeff_mat,_get_dh_grid_cartesian,_eval_on_grid,_fit_from_gridSphericalHarmonicsFilter(new file)Complete implementation following the MATLAB reference:
Both
identityandsqrttransformations produce the same underlying posterior (verified toatol=5e-15intest_prediction_sqrt_vs_id).Minor additions
VonMisesFisherFilter: addedset_state/get_estimate_meanhelpers needed by the shared testpyrecest/filters/__init__.py: exportedVonMisesFisherFiltertest_spherical_harmonics_filter.py: four tests ported from the MATLAB reference suite