Skip to main content

A PyTorch implementation of the Planck 2018 Lite likelihood for the Cosmic Microwave Background (CMB) power spectra

Project description

Torch Planck 2018 Lite

torchplite is a PyTorch implementation of the Planck 2018 Lite likelihood for the Cosmic Microwave Background (CMB) power spectra. This package provides a convenient and efficient way to compute the log-likelihood of CMB power spectra given a cosmological model.

Installation

You can install torchplite via pip from PyPI:

pip install torchplite

This package requires Python 3.6 or later and PyTorch 1.7 or later.

Usage

To use the torchplite package, you can import the PlanckLitePy class and create an instance with the desired settings:

from torchplite import PlanckLitePy

# Initialize the PlanckLitePy object
planck = PlanckLitePy(year=2018, spectra="TTTEEE", use_low_ell_bins=False)

# Load the power spectra
import numpy as np
ls, Dltt, Dlte, Dlee = np.genfromtxt("path/to/your/data/Dl_planck2015fit.dat", unpack=True)

# Compute the log-likelihood
ellmin = int(ls[0])
loglikelihood = planck.loglike(Dltt, Dlte, Dlee, ellmin)

You can customize the behavior of the PlanckLitePy object by changing its constructor parameters:

  • year: The Planck data release year (2015 or 2018).
  • spectra: The CMB power spectra to use ("TTTEEE" for TT, TE, and EE or "TT" for TT only).
  • use_low_ell_bins: Whether to include low-ell bins in the likelihood calculation (True or False).

Running Tests

To run the tests, you can use the unittest module:

python -m unittest discover tests

this will run all the test cases defined in the tests directory.

Licesnse

This project is under the MIT License. See the LICENSE file for more details.

Credit

This is a PyTorch implementation of the planck-lite-py code by Heather Prince.

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

torchplite-0.1.1.tar.gz (3.2 MB view details)

Uploaded Source

Built Distribution

torchplite-0.1.1-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file torchplite-0.1.1.tar.gz.

File metadata

  • Download URL: torchplite-0.1.1.tar.gz
  • Upload date:
  • Size: 3.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for torchplite-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8116a1feae565399c62ef873145c0f9c9fbe9b5fb070b0c35f5462b1f452da55
MD5 97e92d73501cd2a4323e402cf0a3c8bb
BLAKE2b-256 454d17bcdf6d65994e687d61b3a7b414ee1200750dcfdd803e28a68196efb04e

See more details on using hashes here.

File details

Details for the file torchplite-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: torchplite-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for torchplite-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 df9aa668b966f86a3cd81e109e3e1cda583cd3990637602f0e539f4ac69f3cd8
MD5 3c37edfaf7271f5e4b3d364487d39cf1
BLAKE2b-256 d6e0de0c2cbe4125ef52c8d38ca5bf97182a36530401a32f0a4a7aaf9ca28034

See more details on using hashes here.

Supported by

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