jishnub / SphericalHarmonics.jl

Associated Legendre Polynomials and Spherical Harmonics in Julia
MIT License
10 stars 1 forks source link

Real matrix of Spherical Harmonics #60

Open abhayap opened 2 years ago

abhayap commented 2 years ago

For multiple points on the sphere what's the best way to get a matrix where the columns are the points and the rows are the spherical harmonic modes for each of the points?

I did this but it does not work if only one point is passed in.

function Y(N::Integer, θ, ϕ)
    n, m = acnorder(N)
    Yres = computeYlm.(θ, ϕ, lmax = N, SHType = SphericalHarmonics.RealHarmonics())
    Ymat = reduce(hcat, Yres)
    # remove the Condon-Shortley phase
    condon = (-1).^m
    condon .* Ymat
end