Index

PowerSpectra.CovarianceWorkspaceMethod
CovarianceWorkspace(m_i, m_j, m_p, m_q; lmax::Int=0)

Inputs and cache for covariance calculations. A covariance matrix relates the masks of four fields and spins. This structure caches various cross-spectra between masks and noise-weighted masks. By default, operates at Float64 precision.

Arguments:

  • m_i::CovField{T}: map i
  • m_j::CovField{T}: map j
  • m_p::CovField{T}: map p
  • m_q::CovField{T}: map q

Keywords

  • lmax::Int=0: maximum multipole to compute covariance matrix
source
PowerSpectra.coupledcovMethod
coupledcov(ch1, ch2, workspace, spectra;
           noiseratios=Dict(), lmax=0) where T

Arguments:

  • ch1::Symbol: spectrum type of first spectrum (i.e. :TT, :TE, :EE)
  • ch2::Symbol: spectrum type of second spectrum (i.e. :TT, :TE, :EE)
  • workspace: cache for working with covariances
  • spectra: signal spectra

Keywords

  • noiseratios::AbstractDict: ratio of noise spectra to white noise
  • lmax=0: maximum multipole moment for covariance matrix

Returns:

  • SpectralArray{T,2}: covariance matrix (0-indexed)
source
PowerSpectra.decouple_covmatMethod
decouple_covmat(Y, B1, B2; lmin1=2, lmin2=2)

Decouples a covariance matrix Y, performing B₁⁻¹ × Y × (B₂⁻¹)^† by mutating Y.

source
PowerSpectra.fitdipoleFunction
function fitdipole(m::HealpixMap{T}, [w::HealpixMap{T}=1]) where T

Fit the monopole and dipole of a map.

Arguments:

  • m::HealpixMap{T}: map to fit
  • w::HealpixMap{T}: weight map. Defaults to a FillArray of ones.

Returns:

  • Tuple{T, NTuple{3,T}}: (monopole, (dipole x, dipole y, dipole z))
source
PowerSpectra.getblockMethod
getblock(A::BlockSpectralMatrix{T,M_BLOCKS,1}, i) where {T,M_BLOCKS}

Extract a sub-block from a BlockSpectralMatrix.

Arguments:

  • A::BlockSpectralMatrix{T,M_BLOCKS,1}: array to extract from
  • i::Int: index of the sub-block (1-indexed)

Returns:

  • Array{T,2}: sub-blocks
source
PowerSpectra.mask!Method
mask!(m::HealpixMap, mask)
mask!(m::PolarizedHealpixMap, maskT, maskP)

Mask a map or polarized map in place.

Arguments:

  • m::Union{HealpixMap,PolarizedHealpixMap}: map or polarized map to mask
  • maskT::HealpixMap: mask for first map's intensity
  • maskP::HealpixMap: mask for first map's polarization
source
PowerSpectra.masterMethod
master(map₁::PolarizedHealpixMap, maskT₁::HealpixMap, maskP₁::HealpixMap,
       map₂::PolarizedHealpixMap, maskT₂::HealpixMap, maskP₂::HealpixMap; already_masked=false)

Perform a mode-decoupling calculation for two polarized maps, along with masks to apply. Returns spectra for $TT$, $TE$, $ET$, $EE$, $EB$, $BE$, and $BB$.

Arguments:

  • map₁::PolarizedHealpixMap: the first IQU map
  • maskT₁::HealpixMap: mask for first map's intensity
  • maskP₁::HealpixMap: mask for first map's polarization
  • map₂::PolarizedHealpixMap: the second IQU map
  • maskT₂::HealpixMap: mask for second map's intensity
  • maskP₂::HealpixMap: mask for second map's polarization

Keywords

  • already_masked::Bool=false: are the input maps already multiplied with the masks?
  • lmin::Int=0: minimum multipole

Returns:

  • Dict{Symbol,SpectralVector}: spectra Dict, indexed with :TT, :TE, :ET, etc.
source
PowerSpectra.mcmMethod
mcm(spec::Symbol, alm₁::Alm{T}, alm₂::Alm{T}; lmax=nothing)

Compute the mode-coupling matrix. See the Spectral Analysis section in the documentation for examples. These are used by applying the linear solve operator \ to a SpectralArray{T,1}.

Choices for spec:

  • :TT, identical to M⁰⁰
  • :TE, identical to :ET, :TB, :BT, :M⁰², :M²⁰
  • :EE_BB, returns coupling matrix for stacked EE and BB vectors
  • :EB_BE, returns coupling matrix for stacked EB and BE vectors
  • :M⁺⁺, sub-block of spin-2 mode-coupling matrices
  • :M⁻⁻, sub-block of spin-2 mode-coupling matrices

Arguments:

  • spec::Symbol: cross-spectrum of the mode-coupling matrix
  • alm₁::Alm{T}: first mask's spherical harmonic coefficients
  • alm₂::Alm{T}: second mask's spherical harmonic coefficients

Keywords

  • lmin=0: minimum multiple for mode-coupling matrix
  • lmax=nothing: maximum multipole for mode-coupling matrix

Returns:

  • the mode coupling matrix. for single symbols, this returns a SpectralArray{T,2}. if spec is :EE_BB or :EB_BE, returns a BlockSpectralMatrix{T} with 2×2 blocks.
source
PowerSpectra.planck256_mapFunction
planck256_map(freq, split, col, type::Type=Float64) -> HealpixMap{T, RingOrder}

Returns a Planck 2018 half-mission frequency map downgraded to nside 256 in KCMB units. FITS file column numbers are

  1. I_STOKES
  2. Q_STOKES
  3. U_STOKES
  4. HITS
  5. II_COV
  6. IQ_COV
  7. IU_COV
  8. QQ_COV
  9. QU_COV
  10. UU_COV

Arguments:

  • freq::String: Planck frequency ∈ {"100", "143", "217"}
  • split::String: half mission split ∈ {"hm1", "hm2"}
  • col::Int: FITS file column. Either a number, String, or Symbol above.

Returns:

  • Map{T, RingOrder}: the map
source
PowerSpectra.planck256_maskFunction
planck256_mask(freq, split, maptype, T::Type=Float64) -> HealpixMap{T}

Arguments:

  • freq::String: Planck frequency ∈ {"100", "143", "217"}
  • split::String: half mission split ∈ {"hm1", "hm2"}
  • maptype: pass T or P, as a String or Symbol

Returns:

  • HealpixMap{T, RingOrder}: the mask
source
PowerSpectra.quickpolWMethod
quickpolW(alm₁::Alm{Complex{T}}, alm₂::Alm{Complex{T}})

Computes a scaled spectrum of the scan pattern.

\[W_{\ell'}^{\nu_1,\nu_2,s_1,s_2,j_1,j_2} = \sum_{m^\prime=-\ell^\prime}^{\ell^\prime} \left(_{s_1+\nu_1}\tilde{\omega}^{(j_1)}_{\ell^\prime m^\prime}\right) \left(_{s_2+\nu_2}\tilde{\omega}^{(j_2)}_{\ell^\prime m^\prime}\right)^*\]

source
PowerSpectra.quickpolΞ!Method
quickpolΞ!(𝚵::AA, ν₁, ν₂, s₁, s₂, ω₁, ω₂)

This computes the $\Xi_{\ell^{\prime \prime},\ell}$ matrix. It assumes $\rho$ has been absorbed into the $\omega$ terms.

  • ω₁: effective scan weights with spin s₁ + ν₁
  • ω₂: effective scan weights with spin s₂ + ν₂
source
PowerSpectra.spectralonesMethod
spectralones(size1::Int, size2::Int, ...)
spectralones(range1::AbstractRange, range2::AbstractRange, ...)

Utility function for generating a SpectralArray by passing arguments of ranges or sizes, just like ones.

source
PowerSpectra.spectralzerosMethod
spectralzeros(size1, size2, ...)
spectralzeros(range1, range2, ...)

Utility function for generating a SpectralArray by passing arguments of ranges or sizes, just like zeros.

source
PowerSpectra.synalm!Method
synalm!([rng=GLOBAL_RNG], Cl::AbstractArray{T,3}, alms) where T

In-place synthesis of spherical harmonic coefficients, given spectra.

Arguments:

  • Cl::AbstractArray{T,3}: array with dimensions of comp, comp, ℓ
  • alms::Union{NTuple{N,Alm}, Vector{Alm}}: array of Alm to fill

Examples

nside = 16
C0 = [3.  2.;  2.  5.]
Cl = repeat(C0, 1, 1, 3nside)  # spectra constant with ℓ
alms = [Alm{Complex{Float64}}(3nside-1, 3nside-1) for i in 1:2]
synalm!(Cl, alms)
source
PowerSpectra.synalmMethod
synalm([rng=GLOBAL_RNG], Cl::AbstractArray{T,3}, nside::Int) where T

Arguments:

  • Cl::AbstractArray{T,3}: array with dimensions of comp, comp, ℓ
  • nside::Int: healpix resolution

Returns:

  • Vector{Alm{T}}: spherical harmonics realizations for each component

Examples

nside = 16
C0 = [3.  2.;  2.  5.]
Cl = repeat(C0, 1, 1, 3nside)  # spectra constant with ℓ
alms = synalm(Cl, nside)
source
PowerSpectra.ΞsumMethod
Ξsum(alm₁, alm₂, w3j₁, w3j₂)

Sum over $\ell$ and $m$ of two $a_{\ell m}$ and nontrivial Wigner-3j vectors. This is a step in computing the $\mathbf{\Xi}$ matrix. The $\rho$ factors are not in this summation, as they can be pulled out.

\[\begin{aligned} (\Xi \mathrm{sum}) &= \sum_{\ell^{\prime} m^{\prime}} \, W_{\ell'}^{\nu_1,\nu_2,s_1,s_2,j_1,j_2} \times \begin{pmatrix} \ell & \ell^{\prime} & \ell^{\prime\prime} \\ -s_1 & s_1+\nu_1 & -\nu_1 \end{pmatrix} \begin{pmatrix} \ell & \ell^{\prime} & \ell^{\prime\prime} \\ -s_2 & s_2+\nu_2 & -\nu_2 \end{pmatrix} \end{aligned}\]

source
PowerSpectra.@spectraMacro
@spectra [expr=BlockSpectralMatrix]

Unpack a block vector. This is equivalent to calling getblock for all the sub-blocks and putting them in a Tuple.

Example

# compute stacked EE,BB mode-coupling matrix from mask alm
M_EE_BB = mcm(:EE_BB, map2alm(mask1), map2alm(mask2))
# apply the 2×2 block mode-coupling matrix to the stacked EE and BB spectra
@spectra Cl_EE, Cl_BB = M_EE_BB \ [pCl_EE; pCl_BB]
source