Core Cosmology Library (CCL)

repository·master·Indexed 41 days ago

https://github.com/lsstdesc/ccl

A standardized Python/C++ library used to calculate theoretical cosmological observables, including background quantities, power spectra, and angular correlations. It supports $\Lambda$CDM, $w_0-w_a$CDM, and modified gravity extensions, providing tools for calculating the non-linear matter power spectrum via `ccl.nonlin_matter_power` and 3D correlation functions via `ccl.correlation_3d`. It is a primary tool for the LSST Dark Energy Science Collaboration (DESC).

Tokens
31.4K
Snippets
109
Records
156
Agent score
51%

What's inside CCL

  1. Overview of Core Cosmology Library (CCL) capabilities

    master

    The Core Cosmology Library (CCL) is a standardized library for calculating cosmological observables. It is designed to be the standard theoretical prediction package for the LSST Dark Energy Science Collaboration (DESC).

    Key capabilities include:

    • Background quantities: Calculating the Hubble parameter $H(z)$, distances, and other background evolution metrics.
    • Growth factors: Computing linear growth factor $D(z)$ and growth rate $f(z)$.
    • Matter power spectra:
      • Linear $P(k)$ using Boltzmann codes (CLASS, CAMB), emulators, or approximate fitting functions.
      • Non-linear $P(k)$ using various prescriptions, including emulators and baryonic effects.
    • Angular observables: Calculating angular power spectra $C_\ell$ and correlation functions $\xi$ for tracers such as number counts, shear, CMB lensing, ISW, thermal SZ, CIB, and custom tracers.
    • Halo model framework: A comprehensive framework to combine prescriptions for halo mass functions $dn/dM$, halo bias $b(M)$, concentration-mass relations $c(M)$, mass definitions, and halo profiles to predict summary statistics.
    • Cosmology support: Support for $\Lambda$CDM, $w_0-w_a$ CDM (with curvature and massive neutrinos), and modified gravity extensions (e.g., $\mu-\Sigma$).
  2. Overview of CCL capabilities

    master

    The Core Cosmology Library (CCL) is a standardized library for calculating cosmological observables. Key features include:

    • Background Quantities: Hubble parameter $H(z)$, distances, etc.
    • Growth Functions: Linear growth factor $D(z)$ and growth rate $f(z)$.
    • Matter Power Spectra: Linear $P(k)$ (via Boltzmann codes like CLASS/CAMB, emulators, or fitting functions) and non-linear $P(k)$ (including baryonic effects).
    • Angular Observables: Angular power spectra $C_\ell$ and correlation functions $\xi(\theta)$ for tracers like number counts, shear, CMB lensing, ISW, thermal SZ, and CIB.
    • Halo Model Framework: Predictions for halo mass functions, bias, concentration-mass relations, and summary statistics.
    • Cosmology Support: $\Lambda$CDM, $w_0-w_a$CDM (with curvature and massive neutrinos), and modified gravity extensions (e.g., $\mu-\Sigma$).
  3. Overview of the pyccl.emulators package

    master

    The pyccl.emulators package provides cosmological emulators for power spectrum calculations. It is organized into several submodules that specialize in different types of power spectrum emulations (linear, non-linear, or specific model implementations).

    Key submodules include:

    • pyccl.emulators.baccoemu_linear_pk: Linear power spectrum emulations using the Baccoemu model.
    • pyccl.emulators.baccoemu_nonlinear_pk: Non-linear power spectrum emulations using the Baccoemu model.
    • pyccl.emulators.cosmicemu_pk: Power spectrum emulations using the CosmicEmu model.
    • pyccl.emulators.emu_base: The base module for emulator functionality.
  4. Explore pyccl.halos.profiles submodules

    master

    The pyccl.halos.profiles package provides various halo profile implementations used to describe the distribution of matter or tracers within dark matter halos. Depending on your cosmological model or tracer type, you can use one of the following submodules:

    • cib_shang12: Cosmic Infrared Background profiles (Shang et al. 2012).
    • einasto: Einasto profiles.
    • hernquist: Hernquist profiles.
    • hod: Halo Occupation Distribution (HOD) profiles.
    • ia: Intrinsic Alignment (IA) profiles.
    • nfw: Navarro-Frenk-White (NFW) profiles.
    • pressure_gnfw: Generalized NFW profiles for gas pressure.
    • profile_base: Base classes and utilities for defining custom profiles.
  5. Use halo bias models in pyccl.halos.hbias

    master

    The pyccl.halos.hbias package provides various implementations of halo bias models. These models are used to describe how the clustering of halos relates to the underlying matter distribution. You can choose from several specific submodules depending on the theoretical model required:

    • pyccl.halos.hbias.bhattacharya11: Bhattacharya (2011) model.
    • pyccl.halos.hbias.sheth01: Sheth & Tormen (2001) model.
    • pyccl.halos.hbias.sheth99: Sheth (1999) model.
    • pyccl.halos.hbias.tinker10: Tinker et al. (2010) model.
  6. Use concentration models in pyccl.halos.concentration

    master

    The pyccl.halos.concentration package provides various submodules that implement different concentration-mass relations for dark matter halos. These models are used to define how the concentration of a halo depends on its mass and redshift.

    Available concentration models include:

    • bhattacharya13
    • constant
    • diemer15
    • duffy08
    • ishiyama21
    • klypin11
    • prada12
  7. Explore the pyccl.halos package structure

    master

    The pyccl.halos package provides tools for halo modeling in cosmological analyses. It is organized into subpackages for specific halo properties and submodules for various statistical calculations and model definitions.

    Subpackages

    Use these for specific halo-related modeling components:

    • pyccl.halos.concentration: Concentration models for halos.
    • pyccl.halos.hbias: Halo bias modeling.
    • pyccl.halos.hmfunc: Halo mass functions.
    • pyccl.halos.profiles: Halo density profiles.

    Submodules

    Use these for higher-level statistical and model-based calculations:

    • pyccl.halos.halo_model: High-level halo model interface.
    • pyccl.halos.halo_model_base: Base classes for halo models.
    • pyccl.halos.massdef: Mass definitions.
    • pyccl.halos.pk_1pt: 1-point statistics (e.g., number density).
    • pyccl.halos.pk_2pt: 2-point statistics (e.g., power spectrum, correlation function).
    • pyccl.halos.pk_4pt: 4-point statistics.
    • pyccl.halos.profiles_2pt: 2-point statistics related to halo profiles.
  8. Explore the pyccl.modified_gravity package

    master

    The pyccl.modified_gravity package provides tools for implementing and working with modified gravity models within the CCL framework. It is organized into submodules that handle the base abstractions and specific gravity parameterizations.

    Key submodules include:

    • pyccl.modified_gravity.modified_gravity_base: Contains the base classes and interfaces for defining modified gravity models.
    • pyccl.modified_gravity.mu_Sigma: Likely contains implementations for models parameterized by the $\mu$ and $\Sigma$ functions (common in modified gravity phenomenology).
  9. Explore the pyccl.baryons package submodules

    master

    The pyccl.baryons package provides tools for modeling baryonic effects in cosmological calculations. It is organized into several specialized submodules, each implementing different baryonic models or emulators:

    • pyccl.baryons.baccoemu_baryons: Likely contains emulator-based baryonic models.
    • pyccl.baryons.baryons_base: Provides the base classes or interfaces for baryonic models.
    • pyccl.baryons.schneider15: Implements the baryonic model described in Schneider et al. (2015).
    • pyccl.baryons.vandaalen19: Implements the baryonic model described in Van Daalen et al. (2019).
  10. How the Python-C interface works in CCL

    master

    The CCL Python interface is a two-layer system built using SWIG.

    1. SWIG Layer (pyccl.ccllib): This is the autogenerated interface that scans CCL C headers and maps them to Python. It handles the conversion of C array arguments to numpy arrays and manages function name mapping (e.g., removing the ccl_ prefix).
    2. Python Wrapper Layer: This is the user-facing API. It provides a more friendly interface and handles high-level logic. Most modern calculations are implemented directly in Python; C is reserved for performance-critical calculations.

    Important Note on Global State: All global state in the C library (such as power spectra spline initialization) is managed by the Python layer. Before calling C-level functions, ensure internal C data is initialized. You can use methods on the pyccl.Cosmology object, such as compute_distances(), to ensure the necessary state is prepared.

  11. Explore pyccl.nl_pt submodules

    master

    The pyccl.nl_pt package is composed of the following submodules, which you can use depending on your specific modeling needs:

    • pyccl.nl_pt.bacco_lbias: Likely related to Bacco-style bias modeling.
    • pyccl.nl_pt.ept: Likely related to Effective Field Theory (EFT) approaches.
    • pyccl.nl_pt.lpt: Likely related to Lagrangian Perturbation Theory (LPT).
    • pyccl.nl_pt.tracers: Used for creating and managing tracer objects that represent cosmological signals (like galaxy distributions) within these non-linear frameworks.