FastSphericalHarmonics.jl

The FastSphericalHarmonics.jl package wraps the FastTransforms.jl Julia package to calculate Spherical Harmonics.

FastSphericalHarmonics.jl is a powerful, efficient, and well thought out package. Unfortunately, its user interface is difficult to use for beginners, and its documentation is very technical. FastSphericalHarmonics.jl provides functions and documentation that are easier to use. It would be worthwhile to fold FastSphericalHarmonics.jl into FastTransforms.jl at some point.

Most functions come in two versions, one that mutates its arguments and one that allocates its output.

Helper functions and types

FastSphericalHarmonics.sph_pointsFunction
Θ, Φ = sph_points(N::Integer)
Θ::Vector{Float64}
Φ::Vector{Float64}

Calculate the locations of points on the sphere when using N points in the θ (latitudinal) direction.

It is length(Θ) = N and length(Φ) = M where M = 2N-1.

source

Scalar Spherical Harmonics

FastSphericalHarmonics.sph_transform!Function
sph_transform!(F::Array{T,2}) where {T<:SpHTypes}

Transform an array of points F into spherical harmonics. This is an in-place transform, i.e. the array F will be overwritten by the coefficients. Use sph_transform for a non-mutating function.

Use sph_points to caluclate the location of the points on the sphere for the input array F.

Use sph_mode to calculate the location in the output coefficient array for a particular l,m mode.

See also: sph_transform, sph_evaluate!, sph_points, sph_mode

source
FastSphericalHarmonics.sph_transformFunction
C = sph_transform(F::AbstractArray{T,2}) where {T<:SpHTypes}
C::Array{T,2}

Transform an array of points F into spherical harmonics. You can use sph_transform! for more efficient a mutating function that overwrites its argument F.

Use sph_points to caluclate the location of the points on the sphere for the input array F.

Use sph_mode to calculate the location in the output coefficient array for a particular l,m mode.

See also: sph_transform!, sph_evaluate, sph_points, sph_mode

source
FastSphericalHarmonics.sph_evaluate!Function
sph_evaluate!(C::Array{T,2}) where {T<:SpHTypes}

Evaluate an array of coefficients C on the grid points on a sphere. This is an in-place transform, i.e. the array C will be overwritten by the point values. Use sph_evaluate for a non-mutating function.

Use sph_mode to calculate the location in the input coefficient array for a particular l,m mode.

Use sph_points to caluclate the location of the points on the sphere in the output array F.

See also: sph_evaluate, sph_transform!, sph_mode, sph_points

source
FastSphericalHarmonics.sph_evaluateFunction
F = sph_evaluate(C::AbstractArray{T,2}) where {T<:SpHTypes}
F::Array{T,2}

Evaluate an array of coefficients C on the grid points on a sphere. You can use sph_evaluate! for more efficient a mutating function that overwrites its argument C.

Use sph_mode to calculate the location in the input coefficient array for a particular l,m mode.

Use sph_points to caluclate the location of the points on the sphere in the output array F.

See also: sph_evaluate!, sph_transform, sph_mode, sph_points

source

Spin Spherical Harmonics

FastSphericalHarmonics.spinsph_modeFunction
idx = spinsph_mode(l::Integer, m::Integer, s::Integer)
idx::CartesianIndex{2}

Calculate the Cartesian index idx for the l,m mode for spin weight s. This index can be used to access the coefficients, i.e. the result of spinsph_transform or the input to spinsph_evaluate.

Coefficients are stored in a two-dimensional array. Not all array elements are used. See this page, section "spinsph2fourier", for details.

See also: spinsph_transform!, spinsph_transform, spinsph_evaluate!, spinsph_evaluate

source
FastSphericalHarmonics.spinsph_transform!Function
spinsph_transform!(F::Array{Complex{Float64},2}, s::Int)

Calculate the spin spherical harmonic transformation with spin weight s. This is an in-place transform, i.e. the array F will be overwritten by the coefficients. Use spinsph_transform for a non-mutating function.

Use sph_points to caluclate the location of the points on the sphere for the input array F.

Use spinsph_mode to calculate the location in the output coefficient array for a particular l,m mode with spin weight s.

See also: spinsph_transform, spinsph_evaluate!, sph_points, spinsph_mode

source
FastSphericalHarmonics.spinsph_transformFunction
C = spinsph_transform(F::AbstractArray{Complex{Float64},2}, s::Int)
C::Array{Complex{Float64},2}

Calculate the spin spherical harmonic transformation with spin weight s. You can use spinsph_transform! for more efficient a mutating function that overwrites its argument F.

Use sph_points to caluclate the location of the points on the sphere for the input array F.

Use spinsph_mode to calculate the location in the output coefficient array for a particular l,m mode with spin weight s.

See also: spinsph_transform!, spinsph_evaluate, sph_points, spinsph_mode

source
FastSphericalHarmonics.spinsph_evaluate!Function
spinsph_evaluate!(C::Array{Complex{Float64},2}, s::Int)

Evaluate the spin spherical harmonic transformation with spin weight s on points on the sphere. This is an in-place transform, i.e. the array C will be overwritten by the point values. Use spinsph_evaluate for a non-mutating function.

Use spinsph_mode to calculate the location in the input coefficient array for a particular l,m mode with spin weight s.

Use sph_points to caluclate the location of the points on the sphere in the output array F.

See also: spinsph_evaluate, spinsph_transform!, spinsph_mode, sph_points

source
FastSphericalHarmonics.spinsph_evaluateFunction
F = spinsph_evaluate(C::AbstractArray{Complex{Float64},2}, s::Int)
F::Array{Complex{Float64},2}

Evaluate the spin spherical harmonic transformation with spin weight s on points on the sphere. You can use spinsph_evaluate! for more efficient a mutating function that overwrites its argument C.

Use spinsph_mode to calculate the location in the input coefficient array for a particular l,m mode with spin weight s.

Use sph_points to caluclate the location of the points on the sphere in the output array F.

See also: spinsph_evaluate!, spinsph_transform, spinsph_mode, sph_points

source
FastSphericalHarmonics.spinsph_ethFunction
ðC = spinsph_eth(C::AbstractArray{Complex{Float64},2}, s::Int)
ðC::Array{Complex{Float64},2}

Apply the differential operator ð ("eth") to the coefficients C. This raises the spin weight s by 1. For a real function of spin weight 0, this is equivalent to calculating the gradient.

This function is the converse of spinsph_ethbar, which is a derivative operator lowering the spin weight.

Use spinsph_mode to calculate the location in the output coefficient array for a particular l,m mode with spin weight s.

See also: spinsph_ethbar, spinsph_mode

source
FastSphericalHarmonics.spinsph_ethbarFunction
ðC = spinsph_ethbar(C::AbstractArray{Complex{Float64},2}, s::Int)
ðC::Array{Complex{Float64},2}

Apply the differential operator ð̄ ("eth-bar") to the coefficients C. This lowers the spin weight s by 1. For a function of spin weight 1, this is equivalent to calculating the divergence.

This function is the converse of spinsph_eth, which is a derivative operator raising the spin weight.

Use spinsph_mode to calculate the location in the output coefficient array for a particular l,m mode with spin weight s.

See also: spinsph_eth, spinsph_mode

source