2D Tutorial

Here we give a brief introduction on how to use CryoFaB on the 2D sphere.

using Healpix
using CryoFaBs

Then, create a mask, or rather, in inverse of the mask where the observed pixels are ones and the masked pixels are zero. For example:

nside = 4

npix = nside2npix(nside)

mask_Float64 = Float64.(rand(Bool, npix))

mask = HealpixMap{Float64, Healpix.RingOrder}(mask_Float64)

That allows us to create an AngularCryoFaB that contains all the information about the transform:

cfb = AngularCryoFaB(mask)

The object cfb acts like a matrix. It can be queried with some standard functions. For example,

size(cfb)

Whether a point on the sky is in the survey or which index in the input field it has:

yes = isinsurvey(cfb, theta, phi)
idx = coord2cell(cfb, theta, phi)

The angular cryofab acts on fields on the incomplete sphere. To get such a field, we first create a random field on the full sky, then select only those pixels that are not masked:

delta_rhat = rand(npix)[mask .> 0]

The function coord2cell() can also be very helpful in constructing the field delta_rhat, which is an array with length the number of pixels that are observed.

To transform from configuration space to cryospace,

delta_lm = cfb \ delta_rhat

To get the effective ell-modes in delta_lm, use the array cfb.ell.

Compute the power spectrum:

Cl = @. delta_lm * conj(delta_lm)

This will be afflicted by the pixel+geometry window, which we calculate next.

Pixel and Geometry Window

Calculate the pixel and geometry window:

ellavg, pixwin = angular_cryo_window(cfb)

Then, given a prediction Cl_theory evaluated at modes ellavg, the window-convolved power spectrum would be

Cl_theory_mask = pixwin * Cl_theory

to be compared with the measured Cl at modes cfb.ell.