Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gaussian filtering when using pole_density_function #448

Open
harripj opened this issue May 1, 2023 · 2 comments
Open

Gaussian filtering when using pole_density_function #448

harripj opened this issue May 1, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@harripj
Copy link
Collaborator

harripj commented May 1, 2023

When providing the argument sigma > 0 to pole_density_function we currently convolve a gaussian to the distribution histogram. Internally pole_density_function uses an equal area sampling grid on S2 to ensure constant bin areas, however this means that the bin spacing along the latitudinal direction is not consistent and a fixed size gaussian kernel is not 100% appropriate.

An alternative would be to sample the histogram initially on an equal angle (uv) grid, apply the gaussian filter on the equal angle grid, and resample this grid to the equal area grid for quantitative analysis. This is possible but leads to aliasing in the final distribution.

Another alternative would be compute a functional representation of the distribution and apply the blurring in the frequency domain before resampling, this may also help with the pole distortion raised in #441.

@hakonanes
Copy link
Member

If the aliasing isn't too bad, this might be a good option.

Regarding the functional representation, we might look into using spherical harmonics from SciPy (https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.sph_harm.html#scipy.special.sph_harm). These might be useful in other situations of the code, so we can consider creating a (initially private) class to store these and perform operations. Was this what you had in mind?

@hakonanes hakonanes added the enhancement New feature or request label May 2, 2023
@argerlt
Copy link
Contributor

argerlt commented Nov 11, 2024

An alternative would be to sample the histogram initially on an equal angle (uv) grid, apply the gaussian filter on the equal angle grid, and resample this grid to the equal area grid for quantitative analysis. This is possible but leads to aliasing in the final distribution.

@harripj It's just a rough draft, but I wrote some example code that does this in a recent orix issue #532 . specifically, look at the third plot in the second image.

It still needs work before I make a real Pull Request, but if you see problems or have suggestions, feel free to leave a comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants