wale.CommonUtils module
- wale.CommonUtils.apply_pixel_window(ells, theta_deg=10.0, npix=1200)[source]
Compute the pixel window function for a square map and apply it to multipoles.
- Parameters:
ells (array_like) – Multipole values (ℓ) at which the window function is evaluated.
theta_deg (float, optional) – Total angular size of the map in degrees (default is 10.0).
npix (int, optional) – Number of pixels per side of the square map (default is 1200).
- Returns:
W_ell – The pixel window function evaluated at each ℓ.
- Return type:
ndarray
- wale.CommonUtils.compute_sigma_kappa_squared(theta_arcmin, chis, lensingweights, redshifts, k, pnl, filter_type, h)[source]
Compute the smoothed convergence variance σ²_κ(θ) at a given angular scale using a filter.
This function computes the convergence power spectrum P_κ(ℓ) from a 3D P(k, z) and integrates over ℓ using a top-hat or starlet filter.
- Parameters:
theta_arcmin (float) – Angular smoothing scale θ in arcminutes.
chis (ndarray) – Comoving distances χ (in Mpc) corresponding to redshifts.
lensingweights (ndarray) – Lensing kernel W(χ) evaluated at each χ.
redshifts (ndarray) – Redshifts corresponding to chis.
k (ndarray) – Wavenumber grid (in h/Mpc).
pnl (2D ndarray) – Nonlinear power spectrum P(k, z), shape (n_z, len(k)).
filter_type (str) – Type of filter to apply (“tophat” or “starlet”).
h (float) – Reduced Hubble constant (H0 / 100).
- Returns:
sigma2 – Smoothed convergence variance σ²_κ(θ).
- Return type:
float
- wale.CommonUtils.fourier_coordinate(x, y, map_size)[source]
Return the 1D Fourier coordinate index corresponding to 2D (x, y) on a square map.
- Parameters:
x (int) – X-coordinate (horizontal index).
y (int) – Y-coordinate (vertical index).
map_size (int) – Size of one side of the square map.
- Returns:
idx – Flattened Fourier-space index.
- Return type:
int
- wale.CommonUtils.get_l1_from_pdf(counts, bins)[source]
Compute the L1 norm (∫|x|P(x)dx) from a histogram representation of a PDF.
- Parameters:
counts (ndarray) – Histogram bin counts or PDF values (P(x)).
bins (ndarray) – Bin centers or values corresponding to the counts.
- Returns:
l1_norm – L1 norm approximation (P(x) * |x| per bin).
- Return type:
ndarray
- wale.CommonUtils.get_moments(kappa_values, pdf_values)[source]
Compute the first four moments of a given 1D probability distribution.
- Parameters:
kappa_values (ndarray) – Bin centers or sample points along the kappa (x-axis).
pdf_values (ndarray) – Corresponding PDF values at each kappa.
- Returns:
mean_kappa (float) – Mean of the distribution.
variance (float) – Variance of the distribution.
S_3 (float) – Skewness (third standardized moment).
K (float) – Kurtosis minus 3 (excess kurtosis).
norm (float) – Normalization constant of the input PDF.