pyxem / orix

Analysing crystal orientations and symmetry in Python
https://orix.readthedocs.io
GNU General Public License v3.0
80 stars 48 forks source link

Gaussian filtering when using `pole_density_function` #448

Open harripj opened 1 year ago

harripj commented 1 year ago

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 commented 1 year ago

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?