Window functions

The kszx.wfunc_utils module contains functions for computing window functions.

This module is currently a placeholder – it implements a crude approximation for the window function, that can be used to roughly normalize \(P(k)\). In the future I’ll expand it to include an accurate computation of the window function with k-bin mixing, spins, etc.

kszx.wfunc_utils.compute_wcrude(box, fourier_space_footprints, rmax=0.03)

A crude approximation to the \(P(k)\) window function which neglects k-dependence and mixing.

Given N “footprint” maps \(F_{ij}(x)\), this function computes an N-by-N matrix \(W_{ij}\) which gives the window function for a cross power spectrum on footprints i,j. (Note that since we’re neglecting k-dependence and mixing, the window function doesn’t have indices which correspond to k-bins.)

For more details on what is computed, see the sphinx docs:

Function arguments:

  • box (kszx.Box): defines pixel size, bounding box size, and location of observer. See Box for more info.

  • fourier_space_footprints (array or list of arrays): single or multiple Fourier-space maps.

    • Case 1: If fourier_space_footprints is an array, then it represents a single Fourier-space map. (The array shape should be given by box.fourier_space_shape and the dtype should be complex.)

    • Case 2: If fourier_space_footprints is a list of arrays, then it represents multiple Fourier-space maps. (Each map in the list should have shape box.fourier_space_shape and dtype complex.)

  • rmax (float): if correlation between any two footprints is < rmax, then an exception will be thrown. To disable this check, set rmax=0.

The return value is either a scalar in case 1 (single Fourier-space map), or an array of shape (nmaps, nmaps) in case 2 (multiple maps).

Sometimes a footprint is defined by a random catalog. Here is a reminder of how to make a Fourier-space map from a random catalog:

box = ...       # instance of class kszx.Box
cosmo = ...     # instance of class kszx.Cosmology
randcat = ...   # instance of class kszx.Catalog
weights = ...   # 1-d array of length randcat.size

xyz = randcat.get_xyz(cosmo, zcol_name='z')
footprint = kszx.grid_points(box, xyz, rweights, kernel='cubic', fft=True, compensate=True)
kszx.wfunc_utils.compare_pk(pk1, pk2, noisy=True)

A utility function I wrote for testing: compares two P(k) arrays in a normalization-independent way.

Function arguments:

  • pk1, pk2: arrays of either shape (nkbins,) or (nmaps,nmaps,nkbins).

Returns a dimensionless number which is << 1 if the P(k) arrays are nearly equal.

Details of \(W_{crude}\)

In this appendix, we explain what kszx.wfunc_utils.compute_wcrude() actually computes.

Let \(R(x)\), \(R'(x)\) be “footprint fields”, and let \(P_{RR'}^{raw}(k)\) be their unnormalized cross power spectrum. We define:

\[W_{RR'} \equiv \left(\int_{k < 2^{1/3}K} - \int_{2^{1/3}K < k < K} \right) \frac{d^3k}{(2\pi)^3} P^{raw}_{RR'}(k)\]

The purpose of the subtraction is to cancel shot noise. The value of \(W_{RR'}\) should be roughly independent of the choice of \(K\). We choose \(K = 0.6 k_{\rm nyq}\) (I didn’t put much thought into this).

To get some intuition for what \(W_{RR'}\) represents, suppose that footprint field \(R(x)\) is defined by summing over randoms with number density \(n\) in volume \(V\), with constant weight \(w\):

\[R(x) = \sum_{j\in rand} w \delta^3(x-x_j)\]

and similarly for footprint field \(R'(x)\), with \((n,V,w) \rightarrow (n',V',w')\). Then:

\[W_{RR'} \approx nn'WW' \frac{V \cap V'}{V_{\rm box}}\]