Skip to main content

Python package for fast cluster number count likelihood computation

Project description

cosmocnc

cosmocnc is a Python package for evaluating the number count likelihood of galaxy cluster catalogues in a fast, flexible and accurate way. It is based on the use of Fast Fourier Transform (FFT) convolutions in order to evaluate some of the likelihood integrals. The code was introduced in Zubeldia & Bolliet (2024), where the likelihood formalism and implementation are described in detail. If you use the code, please cite the paper.

If you have any questions or comments, please write to Íñigo Zubeldia at iz221 at cam ac uk.

Main features of the code

The main features of the code are the following:

  • It supports three types of likelihoods: an unbinned likelihood, a binned likelihood, and an extreme value likelihood.
  • It also supports the addition of stacked cluster data (e.g., stacked lensing profiles), which is modelled in a consistent way with the cluster catalogue.
  • It links the cluster mass observables (also known as mass proxies, e.g., tSZ signal-to-noise, richness, lensing mass estimate, or X-ray flux) to the cluster mass and redshift through a hierarchical model with an arbitrary number of layers, allowing for correlated scatter between the different mass observables. In each layer, the mass-observable scaling relations and the scatter covariance matrix can be easily defined in a custom way, and can depend on sky location and redshift.
  • It incorporates several widely-used halo mass functions.
  • The unbinned likelihood is the most general and flexible of the three. It supports an arbitrary number of cluster mass observables for each cluster in the sample and it allows for the set of mass observables to vary from cluster to cluster. It also allows for redshift measurement uncertainties. If some mass observables have completely uncorrelated scatter, cosmocnc takes advantage of this fact, boosting its computational performance significantly.
  • The binned and extreme value likelihoods, on the other hand, consider the cluster abundance only across one mass observable and/or redshift, and do not allow for redshift measurement uncertainties.
  • cosmocnc can produce mass estimates for each cluster in the sample, which are derived assuming the hierarchical model that is used to model the mass observables.
  • It also allows for the generation of synthetic cluster catalogues for a given observational set-up.
  • Several of cosmocnc's computations can be accelerated with Python's multiprocessing module.
  • The code is interfaced with the Markov chain Monte Carlo (MCMC) code Cobaya, allowing for easy-to-run MCMC parameter estimation.
  • The code is also interfaced with class_sz, allowing a wide range of cosmological models as well as enabling joint analyses with Cosmic Microwave Background (CMB) and Large Scale Structure (LSS) survey data.

Installation

Download the source code and do

$ pip install -e .

You'll then be able to import cosmocnc in Python with

import cosmocnc

Dependencies: astropy (optional), class_sz (optional), cosmopower (optional), hmf (optional), mcfit (optional).

Tutorials

The main computational capabilities of cosmocnc are illustrated in this Jupyter notebook. In this other one, the code is benchmarked against class_sz.

15/10/2024: Code upgrade

The code was significantly upgraded on 15/10/2024. In particular, the way the survey data (cluster catalogue and observable scaling relations) enter the code was modified, with the goal of making it easier and cleaner to add a new survey. Each survey now comes with two files, a catalogue file and a scaling relations file, where the survey details are specified and the data is formatted so that cosmocnc can process it. An example of these two files for the SO-like catalogues analysed in Zubeldia & Bolliet (2024) can be found in cosmocnc/surveys.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cosmocnc-1.2.tar.gz (832.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cosmocnc-1.2-py3-none-any.whl (831.2 kB view details)

Uploaded Python 3

File details

Details for the file cosmocnc-1.2.tar.gz.

File metadata

  • Download URL: cosmocnc-1.2.tar.gz
  • Upload date:
  • Size: 832.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for cosmocnc-1.2.tar.gz
Algorithm Hash digest
SHA256 828167bd8a3c8a62876b9964d35da753cc2ddb199fab019ef3dcecdbcfea8481
MD5 17918441e251a1a1a9629301c29bfa08
BLAKE2b-256 bd557bf15302c3f93323e87135687fc3063daf87e1daad52a9dbb092fa7516b6

See more details on using hashes here.

File details

Details for the file cosmocnc-1.2-py3-none-any.whl.

File metadata

  • Download URL: cosmocnc-1.2-py3-none-any.whl
  • Upload date:
  • Size: 831.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for cosmocnc-1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f07b33130f4f1f75be2b53ce819099969177228e6cd0fd018e3b1cb731b4c8d9
MD5 60cdde6371c33f319132af5d392f1e87
BLAKE2b-256 611ec7773790fbb995b47be6dd29b042e586b0baa3829e00fb1bb7b10bd8e75e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page