cctoolkit

A package for Cluster Cosmology calculations.

https://github.com/tiagobscastro/cctoolkit

Science Score: 57.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.2%) to scientific vocabulary
Last synced: 10 months ago · JSON representation ·

Repository

A package for Cluster Cosmology calculations.

Basic Info
  • Host: GitHub
  • Owner: TiagoBsCastro
  • License: mit
  • Language: Python
  • Default Branch: ML
  • Size: 3.57 MB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 2
Created almost 2 years ago · Last pushed about 1 year ago
Metadata Files
Readme Contributing License Citation

README.md

CCToolkit

Logo

Build Status DOI Documentation Status License: MIT GitHub last commit

CCToolkit is a Python package designed for Cluster Cosmology calculations. It handles cosmological parameters, power spectrum computations, halo mass functions, and halo bias and integrates with the CAMB library to deliver precise cosmological data processing. ## Table of Contents - [Features](#features) - [Installation](#installation) - [Usage](#usage) - [Examples](#examples) - [Documentation](#documentation) - [Contributing](#contributing) - [License](#license) - [Acknowledgements](#acknowledgements) ## Features - **Cosmological Calculations**: Easily compute various cosmological quantities, including background quantities and power spectra. - **Halo Mass Function (HMF)**: Implements the multiplicity function and HMF parameters for different halo finders based on the model presented in [Castro et al. 2023](https://inspirehep.net/literature/2132031) or the model presented in [Castro et al. 2025](https://inspirehep.net/literature/2910564) for dynamical dark energy cosmologies. - **Halo Bias**: Implements the functions to compute the linear halo bias, with corrections based on the Peak Background Split (PBS) model presented in [Castro et al. 2024b](https://inspirehep.net/literature/2824892). - **Baryonic impact**: Implements the model presented in [Castro et al. 2024a](https://inspirehep.net/literature/2718844) for the baryonic impact on cluster and group masses. - **Utility Functions**: Provides useful utilities for manipulating the power spectrum. ## Installation To install CCToolkit clone the repository and use pip: ```bash git clone https://github.com/TiagoBsCastro/CCToolkit.git cd CCToolkit python -m pip install . ``` ### Dependencies - Python 3.9+ - NumPy - SciPy - CAMB ## Usage To use CCToolkit, start by importing the necessary modules and initializing the `CosmologyCalculator` with your desired cosmological parameters: ```python from cctoolkit import CosmologyCalculator # Define cosmological parameters params = { 'H0': 70.0, # Hubble parameter at z=0 in km/s/Mpc 'Ob0': 0.05, # Baryon density parameter 'Om0': 0.3, # Total matter density parameter (Ob0 + Om_c0) 'sigma8': 0.8, # rms density fluctuation amplitude at 8 h^-1 Mpc 'ns': 0.96, # Scalar spectral index 'TCMB': 2.7255, # CMB Temperature at z=0 in K 'mnu': 0.06, # Sum of neutrino masses (eV) 'num_massive_neutrinos': 1 # Number of massive neutrinos species } # Initialize the calculator cosmo_calc = CosmologyCalculator(params) ``` ## Examples ### Halo Mass Function Calculate the halo mass function for a range of masses following [Castro et al. 2023](https://inspirehep.net/literature/2132031): ```python import numpy as np import matplotlib.pyplot as plt masses = np.logspace(13, 15.5, num=100) hmf = cosmo_calc.dndlnM(masses, 0) plt.loglog(masses, hmf) plt.xlabel(r"$M_{\rm vir}\,[M_\odot h^{-1}]$") plt.ylabel(r"$\frac{{\rm d} n}{{\rm d} \log M}\,[{\rm Mpc}^{-3} h^{3}]$") plt.show() ``` Alternatively, using following the model [Castro et al. 2025](https://inspirehep.net/literature/2910564) for dynamical dark energy: ```python import numpy as np import matplotlib.pyplot as plt masses = np.logspace(13, 15.5, num=100) hmf = cosmo_calc.dndlnM(masses, 0, model='castro25') plt.loglog(masses, hmf) plt.xlabel(r"$M_{\rm vir}\,[M_\odot h^{-1}]$") plt.ylabel(r"$\frac{{\rm d} n}{{\rm d} \log M}\,[{\rm Mpc}^{-3} h^{3}]$") plt.show() ``` ### Halo Bias CCToolkit can compute both the PBS prescription as well as the corrected model following [Castro et al. 2024b](https://inspirehep.net/literature/2824892). ```python pbs = cosmo_calc.pbs_bias(masses, 0) bias = cosmo_calc.bias(masses, 0) plt.loglog(masses, pbs, label=r'${\rm PBS}$') plt.loglog(masses, bias, label=r'${\rm Castro\, et\,al.\,2024}$') plt.xlabel(r"$M_{\rm vir}\,[M_\odot h^{-1}]$") plt.ylabel(r"$b(M)$") plt.legend() plt.show() ``` ### Baryonic Impact CCToolkit can compute the equivalent dark-matter-only halo mass of a hydrodynamical simulated group or cluster in two simple steps following the model of [Castro et al. 2024a](https://inspirehep.net/literature/2718844): ```python import cctoolkit from cctoolkit import baryons from cctoolkit.cosmology import CosmologyCalculator z = 0.0 # Magneticum cosmology params = {"Om0": 0.272, "Ob0": 0.272 * 0.168, "H0": 70.4, "ns": 0.963, "mnu":0, "num_massive_neutrinos": 0, "sigma8": 0.809} cosmo_calc = CosmologyCalculator() # Array of virial masses on hydro M = np.geomspace(1e13, 3e14) # Calculating the equivalent DMO mass at the threshold of equivalence according to the quasi-adiabatic model M_Delta_dmo, Delta = baryons.compute_dmo_mass(M, z, 0.168) Delta *= cctoolkit.utils.virial_Delta(cosmo_calc.Omega_m(z)) # Converting to the virial mass mdmo = [baryons.compute_rec_mass(cosmo_calc, m, d, z) for m, d in zip(M_Delta_dmo, Delta)] ``` ## Documentation Please visit [CCToolkit Documentation](https://cctoolkit.readthedocs.io) for detailed documentation and API reference. ## Contributing Contributions are welcome! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details on how to contribute to this project. You can report issues, suggest features, or submit pull requests. ## License This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information. ## Acknowledgements This package relies on the CAMB library for cosmological calculations. We also acknowledge the authors of the various halo finder software used to produce the best-fit parameters implemented in this package.

Owner

  • Name: Tiago Castro
  • Login: TiagoBsCastro
  • Kind: user
  • Location: Trieste
  • Company: @OATS

Post-Doc at INAF / OATS

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use CCToolkit in your research, please cite it using the following metadata."
title: "CCToolkit: A Python Package for Cluster Cosmology Calculations"
authors:
  - family-names: Castro
    given-names: Tiago
    orcid: "https://orcid.org/0000-0002-6292-3228"
    affiliation: "INAF-Osservatorio Astronomico di Trieste, Via G. B. Tiepolo 11, 34143 Trieste, Italy; INFN, Sezione di Trieste, Via Valerio 2, 34127 Trieste TS, Italy; IFPU, Institute for Fundamental Physics of the Universe, via Beirut 2, 34151 Trieste, Italy; ICSC - Centro Nazionale di Ricerca in High Performance Computing, Big Data e Quantum Computing, Via Magnanelli 2, Bologna, Italy"
  - family-names: Fumagalli
    given-names: Alessandra
    orcid: "https://orcid.org/0009-0004-0300-2535"
    affiliation: "Ludwig-Maximilians-University, Schellingstrasse 4, 80799 Munich, Germany; IFPU, Institute for Fundamental Physics of the Universe, via Beirut 2, 34151 Trieste, Italy"
keywords:
  - "cosmology"
  - "cluster cosmology"
  - "halo mass function"
  - "halo bias"
  - "baryonic impact"
  - "Python"
  - "CAMB"
license: MIT
repository-code: "https://github.com/TiagoBsCastro/CCToolkit"
version: 1.0.3
doi: 10.5281/zenodo.13479345
url: "https://github.com/TiagoBsCastro/CCToolkit"
date-released: 2024-08-29
abstract: "CCToolkit is a Python package designed for Cluster Cosmology calculations. It handles cosmological parameters, power spectrum computations, halo mass functions, and halo bias and integrates with the CAMB library to deliver precise cosmological data processing. Key features include cosmological calculations, halo mass function computations, halo bias models, baryonic impact analysis, and utility functions for manipulating the power spectrum."

GitHub Events

Total
  • Push event: 13
Last Year
  • Push event: 13

Dependencies

setup.py pypi
  • camb *
  • numpy *
  • scipy *
.github/workflows/build.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • actions/upload-artifact v2 composite
requirements.txt pypi
  • camb *
  • numpy *
  • pytest *
  • scipy *
  • sphinx *
  • sphinx-rtd-theme *