A Needlet Internal Linear Combination (NILC) code for Python.
NeeLC provides tools for performing needlet decomposition and internal linear combination analysis on HEALPix maps, commonly used in CMB and multi-frequency astrophysical data analysis.
pip install .For development (includes matplotlib for plotting):
pip install -e ".[dev]"import numpy as np
import healpy as hp
from neelc import GaussianNeedlet, CosineNeedlet
# Gaussian needlets defined by FWHM scales (in arcmin, descending order)
need = GaussianNeedlet(theta_fwhms_arcmin=np.array([300., 120., 60.]), l_max=1000)
# Or cosine needlets defined by multipole ranges
need = CosineNeedlet(
l_peaks=np.array([50, 200, 500]),
l_mins=np.array([0, 50, 200]),
l_maxs=np.array([50, 200, 1000]),
)
# Decompose a map into needlet coefficients
m = hp.read_map("my_map.fits")
beta_j = need.map2betajk(m, j=0) # coefficients in band j=0
# Plot the needlet filters
need.plot_filter()from neelc import NILC, CosineNeedlet
need = CosineNeedlet(l_peaks, l_mins, l_maxs)
# Define frequencies and beams (FWHM in arcmin)
freqs = [90, 150, 220]
beams = {90: 5.0, 150: 3.5, 220: 2.5}
nilc = NILC(need, freqs, beams, eff_fwhm=20.)
# Get needlet coefficients for multi-frequency maps
betajk = nilc.get_betajk(maparr)
# Compute covariance of needlet coefficients
betajk_cov = nilc.get_betajk_cov(betajk=betajk)Needlet-- Base class for needlet analysisGaussianNeedlet(theta_fwhms_arcmin, l_max)-- Needlets with Gaussian window functionsCosineNeedlet(l_peaks, l_mins, l_maxs)-- Needlets with cosine window functions
NILC(need, freqs, beams, ...)-- Needlet Internal Linear Combination analysis
reduce_lmax(alm, lmax)-- Reduce the maximum multipole of an alm arraymasked_smoothing(U, fwhm)-- Gaussian smoothing with proper mask handling
- Delabrouille et al. (2009) -- NILC method
- Basak & Delabrouille (2012) -- Needlet ILC
- McCarthy & Hill (2023) -- arXiv:2307.01043