Port SphericalHarmonicsFilter from MATLAB to Python#1588
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>
✅MegaLinter analysis: Success
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
|
dd20732 to
cead808
Compare
|
Do not use numpy but rather pyrecest.backend. Suppress the too-many-locals and the redefined-builtin locally at the respective line. ************* Module pyrecest.distributions.hypersphere_subset.spherical_harmonics_distribution_complex Your code has been rated at 9.97/10 |
|
@copilot Do not use numpy but rather import from pyrecest.backend (similar to other classes) clm = name = None
E NameError: name 'np' is not defined pyrecest/distributions/hypersphere_subset/spherical_harmonics_distribution_complex.py:223: NameError -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
|
…rnings inline Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/8a1be072-ebc1-45ed-96f5-9a2928d3e358 Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>
Fixed in 7d7cc39:
... Fixed in 7d7cc39 — |
|
@copilot Fix this. Use the m, n convention of sph_harm of numpy. Ambiguous variable name: E741 Ambiguous variable name: |
Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/025bb350-9ca6-48d4-b2a3-4f3648a90e98 Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>
|
@copilot ensure no numpy arrays are used and use functions from precest.backend instead FAILED pyrecest/tests/filters/test_spherical_harmonics_filter.py::SphericalHarmonicsFilterTest::test_prediction_sqrt_vs_id - TypeError: linalg_norm() received an invalid combination of arguments - got (numpy.ndarray, keepdim=bool, dim=NoneType, ord=NoneType), but expected one of:
|
Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/c51f7cee-26a7-4156-a2d6-d3e34624b1ed Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>
Fixed in 8dda79b:
|
|
@copilot Throw an error when using jax and use skipif for the tests (see other classes in which I did this). ========================== short test summary info ============================ |
…tests Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/6917fd2b-c330-4bbf-b501-64e469e169a8 Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>
Fixed in be3d500:
|
|
@copilot Use skipIf for all the failed test cases for jax =========================== short test summary info ============================ |
…onComplexTest Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/229b74a5-5797-45e5-8fc5-eece197826e1 Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>
Fixed in 2638eb1 — added a class-level |
|
@copilot fix this workspace/.flake8 pyrecest/init.py pyrecest/distributions/init.py pyrecest/distributions/abstract_bounded_domain_distribution.py pyrecest/distributions/abstract_bounded_nonperiodic_distribution.py pyrecest/distribution...(truncated)] |
Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/b032f905-282d-40a1-85eb-f90b1c1453b8 Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>
Fixed in 39ce44b — removed the two duplicate imports on the lines that preceded the comprehensive |
|
@copilot fix this
|
This was already addressed in 39ce44b — the duplicate |

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