sys_mapping.power_spectrum
Harmonic-space systematic mitigation via pseudo-\(C_\ell\) estimators.
Inputs: Full-sky HEALPix overdensity map, survey mask, template maps, and estimated contamination amplitudes.
Outputs: Pseudo-\(C_\ell\) arrays (shape (lmax+1,)), bias
corrections, and mode-projected power spectra.
The pipeline is:
measure_pseudo_cl()— apply mask and callhealpy.anafast.subtract_template_cl()— subtract \(\sum_i \hat\alpha_i \hat C_\ell^{t_i}\).harmonic_bias()— compute the residual bias \(b_\ell = -n/(2\ell+1)\).mode_projection_bias()— apply BMP or EMP deprojection.
Key papers: Elsner et al. 2016; Elsner et al. 2017; Leistedt & Peiris 2014 — see also Methods Reference.
Harmonic-space systematic mitigation via pseudo-Cℓ estimators.
Implements the template subtraction, harmonic bias correction, and Basic/Extended Mode Projection (BMP/EMP) methods described in Elsner, Leistedt & Peiris 2016 (MNRAS 456, 2095) and Elsner, Leistedt & Peiris 2017 (MNRAS 465, 1847).
- sys_mapping.power_spectrum.measure_pseudo_cl(delta_g, mask, lmax=None, *, use_pixel_weights=True)[source]
Measure the pseudo-Cℓ power spectrum of a galaxy overdensity map.
Applies the survey mask, then calls
healpy.anafastto compute the pseudo-Cℓ. The mask is applied multiplicatively so that pixels outside the footprint do not contribute.- Parameters:
delta_g (ndarray) – Full-sky HEALPix overdensity map (shape
(n_pix,)). Pixels outside the survey should be set to 0 (or masked bymask).mask (ndarray) – Boolean or float weight map (shape
(n_pix,)).True/ 1.0 marks good (included) pixels.lmax (int | None) – Maximum multipole. Defaults to
3 * nside - 1.use_pixel_weights (bool) – If
True, passuse_pixel_weights=Truetohealpy.anafastfor improved accuracy at high ℓ.
- Returns:
ell – Integer multipole array
[0, 1, …, lmax].pseudo_cl – Pseudo-Cℓ estimates (shape
(lmax+1,)), not corrected for mask mode-coupling.
- Return type:
Notes
The pseudo-Cℓ is related to the true power spectrum via the mode-coupling matrix \(M_{\ell\ell'}\) (MASTER equation):
\[\langle\tilde C_\ell\rangle = \sum_{\ell'} M_{\ell\ell'}\,C_{\ell'}\]For a clean field without systematics, a simple correction by the mask power (mean-square of the mask) provides a first-order approximation.
References
Elsner, Leistedt & Peiris 2016, MNRAS 456, 2095. Ho et al. 2012, ApJ 761, 14.
- sys_mapping.power_spectrum.subtract_template_cl(pseudo_cl, delta_t, mask, alpha, lmax=None)[source]
Subtract template pseudo-Cℓ contributions from the measured power spectrum.
Implements the template subtraction (TS) method of Elsner+2016 (Eq. 1–2):
\[\tilde C_\ell^{\rm TS} = \hat C_\ell^{d\times d} - \sum_i \hat\alpha_i\,\hat C_\ell^{t_i \times t_i}\]- Parameters:
pseudo_cl (ndarray) – Measured pseudo-Cℓ of the galaxy field (shape
(lmax+1,)).delta_t (ndarray) – Template maps (shape
(n_sys, n_pix)).mask (ndarray) – Survey mask (shape
(n_pix,)).alpha (ndarray) – Contamination amplitude estimates (shape
(n_sys,)).lmax (int | None) – Maximum multipole. If
None, inferred fromlen(pseudo_cl) - 1.
- Returns:
Template-subtracted pseudo-Cℓ (shape
(lmax+1,)).- Return type:
cl_cleaned
Notes
The residual bias after template subtraction is
\[b_\ell = -\frac{n_{\rm sys}}{2\ell+1}\]Use
harmonic_bias()to compute and subtract this term.References
Elsner, Leistedt & Peiris 2016, MNRAS 456, 2095.
- sys_mapping.power_spectrum.harmonic_bias(n_templates, ell)[source]
Closed-form additive bias from template subtraction.
Template subtraction introduces a systematic negative bias in each multipole band (Elsner+2016, Eq. 8):
\[b_\ell = -\frac{n_{\rm templates}}{2\ell+1}\]- Parameters:
- Returns:
Additive bias on \(C_\ell\) (shape
(n_ell,)). Subtract this from the measured \(C_\ell\) to obtain an unbiased estimate.- Return type:
bias
References
Elsner, Leistedt & Peiris 2016, MNRAS 456, 2095, Eq. 8.
- sys_mapping.power_spectrum.mode_projection_bias(pseudo_cl, coupling_matrix, ell, n_templates, *, mode='basic', threshold=0.1)[source]
Apply Basic or Extended Mode Projection (BMP/EMP) with bias correction.
BMP marginalises over template modes by modifying the pixel covariance; the result is equivalent to projecting the templates from the data vector before computing the power spectrum. EMP extends this by only projecting modes whose template-to-signal ratio exceeds a threshold.
- Parameters:
pseudo_cl (ndarray) – Measured pseudo-Cℓ of the galaxy field (shape
(n_ell,)).coupling_matrix (ndarray | None) – Mode-coupling matrix \(M_{\ell\ell'}\) (shape
(n_ell, n_ell)). IfNone, the identity matrix is used (full-sky approximation).ell (ndarray) – Multipole array (shape
(n_ell,)).n_templates (int) – Number of templates projected.
mode (str) –
"basic"for BMP or"extended"for EMP.threshold (float) – EMP-only. Modes with template-to-signal ratio below this threshold are not projected. Typical values: 0.05–0.20.
- Returns:
cl_deproj – Deprojected power spectrum estimate (shape
(n_ell,)).bias_correction – Additive bias that has been subtracted from
pseudo_clto obtaincl_deproj(shape(n_ell,)).
- Return type:
Notes
BMP bias per multipole (Elsner+2016):
\[b_\ell^{\rm BMP} = -\frac{n_{\rm templates}}{2\ell+1}\]This is the same as the template subtraction bias — the advantage of BMP over TS is that the amplitude \(\hat\alpha_i\) does not need to be estimated externally.
EMP applies the same correction only to modes where \(\hat C_\ell^{t_i} / C_\ell^{ss} > \text{threshold}\). Modes below the threshold are left uncorrected (smaller variance penalty).
When
coupling_matrixisNone(identity), the result is a full-sky approximation. For cut-sky surveys use the mask coupling matrix from NaMaster (pymaster.compute_coupling_matrix).References
Elsner, Leistedt & Peiris 2016, MNRAS 456, 2095, Sec. 3. Leistedt & Peiris 2014, MNRAS 444, 2.