Skip to main content

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.

Metadata

Release files for cosmocnc 1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cosmocnc 1.2
File Size Uploaded Provenance Actions
cosmocnc-1.2.tar.gz 832.0 kB Without provenance Details for cosmocnc-1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cosmocnc 1.2
File Interpreter ABI Platform Actions
cosmocnc-1.2-py3-none-any.whl Python 3 none any Details for cosmocnc-1.2-py3-none-any.whl

Total release size: 1.7 MB

Release files / cosmocnc-1.2.tar.gz

Download URL cosmocnc-1.2.tar.gz
Size 832.0 kB
Tags Source
SHA-256 checksum
How to use checksums
828167bd8a3c8a62876b9964d35da753cc2ddb199fab019ef3dcecdbcfea8481
BLAKE2b-256 checksum
How to use checksums
bd557bf15302c3f93323e87135687fc3063daf87e1daad52a9dbb092fa7516b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / cosmocnc-1.2-py3-none-any.whl

Download URL cosmocnc-1.2-py3-none-any.whl
Size 831.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f07b33130f4f1f75be2b53ce819099969177228e6cd0fd018e3b1cb731b4c8d9
BLAKE2b-256 checksum
How to use checksums
611ec7773790fbb995b47be6dd29b042e586b0baa3829e00fb1bb7b10bd8e75e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for cosmocnc 1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page