PolySpec (formerly PolyBin) is a Python code that estimates
- Templates: This directly estimates the amplitude of inflationary templates in CMB data, such as gNL or tauNL, in addition to late time templates such as CMB lensing. This includes thirteen types of trispectrum estimator (see below), and provides quasi-optimal estimates of the template amplitudes, accounting for arbitrary beams, masks, and filtering.
- Binned Statistics: This estimates the binned power spectrum, bispectrum and trispectrum of a 2D field, accounting for correlations between bins. For each statistic, two estimators are available: the standard/ideal estimators (i.e. pseudo-Cl), which do not take into account the mask, and window-deconvolved estimators, which do. In the second case, we require computation of a numerical Fisher matrix; this depends on binning and the mask, but does not need to be recomputed for each new simulation. For the bispectrum and trispectrum, we can compute both the parity-even and parity-odd components, accounting for any leakage between the two.
PolySpec contains the following main modules:
pspec_bin
: Binned power spectrabspec_bin
: Binned bispectratspec_bin
: Binned trispectratspec_template
: Direct estimation of trispectrum template amplitudes
In the templates class, we can estimate the following types of trispectra:
gNL-loc
,tauNL-loc
: Cubic local templatesgNL-con
: Featureless constant templategNL-dotdot
,gNL-dotdel
,gNL-deldel
: Effective Field Theory of Inflation templatestauNL-direc
,tauNL-even
,tauNL-odd
: Direction-dependent tauNL templatestauNL-heavy
,tauNL-light
: Cosmological collider signatures from massive spinning particleslensing
,point-source
: CMB lensing and point source amplitudes
For details on the binned estimators, see the Binned Tutorial. For details on the template estimators see the Template Tutorial.
Below, we demonstrate how to use PolySpec to compute gNL-loc and the lensing amplitude from a dataset. This depends on a number of inputs, which are discussed in the tutorial.
import polyspec as ps, numpy as np
# Load base class, specifying the fiducial spectrum and beam
base = ps.PolySpec(Nside, fiducial_Cl_tot, beam, backend="ducc")
# Load the trispectrum template class, specifying the templates to analyze
tspec = ps.TSpecTemplate(base, smooth_mask, applySinv, ["gNL-loc","lensing"],
k_array, transfer_array, lmin=lmin, lmax=lmax, Lmin=Lmin, Lmax=Lmax,
C_phi=Cl_phi, C_lens_weight = Cl_lensed)
# Perform optimization to compute the radial integration points
tspec.optimize_radial_sampling_1d()
# Compute the Fisher matrix as a Monte Carlo sum
fish = np.mean([tspec.compute_fisher_contribution(seed) for seed in range(Nfish)],axis=0)
# Compute the trispectrum estimator
tspec.generate_sims(Nnum)
estimate = np.linalg.inv(fish)@tspec.Tl_numerator(data)
# Print run-time statistics
tspec.report_timings()
We can use similar code to compute binned polyspectra. Here's an example for the bispectrum:
# Load the binned bispectrum class, specifying the fields to analyze
bspec_bin = ps.BSpecBin(base, smooth_mask, applySinv, l_bins, fields=['TTT','TTE','TEE','EEE'])
# Compute the Fisher matrix as a Monte Carlo sum
fish = np.mean([bspec_bin.compute_fisher_contribution(seed) for seed in range(Nfish)],axis=0)
# Compute the bispectrum estimator
bspec_bin.generate_sims(Nnum)
estimate = np.linalg.inv(fish)@bspec_bin.Bl_numerator(data)
Further details can be found in the Tutorials. We additionally provide a sample scripts demonstrating the application of PolySpec to Planck trispectrum templates and Planck binned bispectra in a realistic set-up.
- Oliver Philcox (Columbia / Stanford / Simons Foundation)
- Python 3
- healpy, fitsio, tqdm (pip installable)
- pywigxjpf [for binned spectra]
- Cython [for template analyses]
- ducc0 [optional but recommended, for fast SHTs]
- wignerSymbols [included with the Cython module]
When using the template estimators, a number of Cython modules must be installed. This can be done using the following command:
cd polyspec/cython; python setup.py build_ext --inplace; cd ../../
- Philcox, O. H. E., "Optimal Estimation of the Binned Mask-Free Power Spectrum, Bispectrum, and Trispectrum on the Full Sky: Scalar Edition", (2023) (arXiv)
- Philcox, O. H. E., "Optimal Estimation of the Binned Mask-Free Power Spectrum, Bispectrum, and Trispectrum on the Full Sky: Tensor Edition", (2023) (arXiv)
- Philcox, O. H. E., "Searching for Inflationary Physics with the CMB Trispectrum: Primordial Theory & Optimal Estimators", (2025, to appear)
- Philcox, O. H. E., "Searching for Inflationary Physics with the CMB Trispectrum: Code & Validation", (2025, to appear)
- Philcox, O. H. E., "Do the CMB Temperature Fluctuations Conserve Parity?", (2023) (arXiv)
- Philcox, O. H. E., Shiraishi, M., "Testing Parity Symmetry with the Polarized Cosmic Microwave Background", (2023) (arXiv)
- Philcox, O. H. E., Shiraishi, M., "Testing graviton parity and Gaussianity with Planck T-, E-, and B-mode bispectra", (2024) (arXiv)
- Philcox, O. H. E., Shiraishi, M., "Non-Gaussianity Beyond the Scalar Sector: A Search for Tensor and Mixed Tensor-Scalar Bispectra with Planck Data", (2024) (arXiv)
- Philcox, O. H. E., "Searching for Inflationary Physics with the CMB Trispectrum: Constraints from Planck", (2025, to appear)