Giter Site home page Giter Site logo

polybin3d's Introduction

PolyBin3D

PolyBin3D is a Python code that estimates the binned power spectrum and bispectrum for 3D fields such as the distributions of matter and galaxies, using the algorithms of Philcox 2020, Philcox 2021, Ivanov et al. 2023 and Philcox & Flöss 2024. It is a sister code to PolyBin, which computes the polyspectra of data on the two-sphere and is a modern reimplementation of the former Spectra-Without-Windows code.

For each statistic, two estimators are available: the standard (ideal) estimators, which do not take into account the mask, and window-deconvolved estimators. In the second case, we require computation of a Fisher matrix; this depends on binning and the mask, but does not need to be recomputed for each new simulation.

The code supports GPU acceleration using JAX, which can be enabled using the backend argument in the base class, as demonstrated below.

PolyBin contains the following modules:

  • pspec: Binned power spectra
  • bspec: Binned bispectra

The basic usage of the power spectrum class is the following:

# Import code
import PolyBin3D as pb
import numpy as np

# Load base class
base = pb.PolyBin3D(boxsize, # dimensions of box 
                    gridsize, # dimensions of Fourier-space grid, 
                    boxcenter=[0,0,0], # center of simulation box
                    pixel_window='tsc', # pixel window function
                    backend='fftw', # backend for performing FFTs ('fftw' for cpu, 'jax' for gpu)
                    nthreads=4, # number of CPUs for performing FFTs (only applies to 'fftw' backend)
                    sightline='global') # redshift-space axis                    

# Load power spectrum class
pspec = pb.PSpec(base, 
                 k_bins, # k-bin edges
                 lmax, # Legendre multipoles
                 mask, # real-space mask
                 applySinv, # filter to apply to data
                )

# Compute Fisher matrix and shot-noise using Monte Carlo simulations (should usually be parallelized)
fish, shot_num = pspec.compute_fisher(10, N_cpus=1, verb=True)

# Compute windowed power spectra
Pk_ideal = pspec.Pk_ideal(data) 

# Compute unwindowed power spectra, using the Fisher matrix we just computed
Pk_unwindowed = pspec.Pk_unwindowed(data, fish=fish, shot_num=shot_num, subtract_shotnoise=False)

Bispectra can be computed similarly:

# Load bispectrum class
bspec = pb.BSpec(base, 
                 k_bins, # k-bin edges
                 lmax, # Legendre multipoles
                 mask, # real-space mask
                 applySinv, # filter to apply to data
                )

# Compute Fisher matrix using Monte Carlo simulations (should usually be parallelized)
fish = bspec.compute_fisher(10, N_cpus=1, verb=True)

# Compute windowed bispectra
Bk_ideal = bspec.Bk_ideal(data) 

# Compute unwindowed bispectra using the Fisher matrix we just computed
Bk_unwindowed = bspec.Bk_unwindowed(data, fish=fish, include_linear_term=False)

Further details are described in the tutorials, which describe

  • Tutorial 1: introduction to PolyBin3D, and computing the power spectrum from simulations
  • Tutorial 2: validation of the window-deconvolved power spectrum estimators
  • Tutorial 3: application of the power spectrum esitmators to the BOSS DR12 dataset
  • Tutorial 4: introduction to computing bispectra
  • Tutorial 5: validation of the window-deconvolved bispectrum estimators

Authors

Dependencies

  • Python 2/3
  • numpy, scipy
  • fftw [for FFTs]
  • Nbodykit [not required, but useful for testing]
  • JAX (for GPU acceleration, see here for installation instructions.)

References

Code references:

  1. Philcox, O. H. E. & Flöss, T.: "PolyBin3D: A Suite of Optimal and Efficient Power Spectrum and Bispectrum Estimators for Large-Scale Structure", (2024) (arXiv)
  2. Philcox, O. H. E., "Cosmology Without Window Functions: Quadratic Estimators for the Galaxy Power Spectrum", (2020) (arXiv)
  3. Philcox, O. H. E., "Cosmology Without Window Functions: Cubic Estimators for the Galaxy Bispectrum", (2021) (arXiv)
  4. Ivanov, M. M., Philcox, O. H. E., et al. "Cosmology with the Galaxy Bispectrum Multipoles: Optimal Estimation and Application to BOSS Data" (2023) (arXiv)

Some works using data from PolyBin3D (or its predecessor)

  • Philcox & Ivanov (2021, arXiv): Combined constraints on LambdaCDM from the BOSS power spectrum and bispectrum.
  • Cabass et al. (2022, arXiv): Constraints on single-field inflation from the BOSS power spectrum and bispectrum.
  • Cabass et al. (2022, arXiv): Constraints on multi-field inflation from the BOSS power spectrum and bispectrum.
  • Nunes et al. (2022, arXiv): Constraints on dark-sector interactions from the BOSS galaxy power spectrum.
  • Rogers et al. (2023, arXiv): Ultra-light axions and the S8 tension: joint constraints from the cosmic microwave background and galaxy clustering.
  • Ivanov et al. (2023, arXiv): Cosmology with the Galaxy Bispectrum Multipoles: Optimal Estimation and Application to BOSS Data.
  • Moretti et al. (2023, arXiv): Constraints on the growth index and neutrino mass from the BOSS power spectrum.
  • He et al. (2023, arXiv): Self-Interacting Neutrinos in Light of Large-Scale Structure Data.
  • Camarena et al. (2023, arXiv): The two-mode puzzle: Confronting self-interacting neutrinos with the full shape of the galaxy power spectrum

polybin3d's People

Contributors

oliverphilcox avatar tsfloss avatar epaillas avatar

Stargazers

Jamie Sullivan avatar Ken Osato avatar  avatar Song Huang avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.