Skip to main content

A likelihood based on UVPSpec objects

Project description

A small but powerful interface to generate theoretical likelihoods from ``UVPSpec`` objects.

https://github.com/hera-team/pspec_likelihood/workflows/Tests/badge.svg https://codecov.io/gh/hera-team/pspec_likelihood/branch/master/graph/badge.svg https://img.shields.io/badge/code%20style-black-000000.svg pre-commit.ci status

Full Documentation

Read the docs.

Features

  • Ingests data output from hera_pspec: power spectra, covariance matrices and window functions.

  • Agnostic to theory code (i.e. run 21cmFAST or ARES or any other model)

  • Outputs a log-likelihood to be used in parameter inference, but is sampler agnostic.

Installation

Clone/download the repo and pip install ., or pip install git+git://github.com/hera-team/pspec_likelihood.

If developing:

git clone https://github.com/hera-team/pspec_likelihood
cd pspec_likelihood
pip install -e .[dev]
pre-commit install

Quickstart

Import like this:

from pspec_likelihood import DataModelInterface, Gaussian

To construct a likelihood, you first need to construct the DataModelInterface, for which you will specify the data, its covariance, a window function, and a model both for the theory and the systematics. This class contains all the methods required to compute the model/systematics and transform it consistently to data-space.

Secondly, you need to construct a PSpecLikelihood, via one of its concrete sub-classes. Examples of such subclasses are Gaussian and GaussianLinearSystematics. The reason these are their own class, instead of being part of the DataModelInterface, is for the sake of modularity and extensibility. This allows different actual likelihoods to be computed given the data, and new likelihoods to be implemented with ease. The basic requirement of a PSpecLikelihood subclass is that it must implement the loglike(theory_params, sys_params) method, which goes and computes the actual log-likelihood given a set of parameters. It has access to the DataModelInterface object through its model attribute. So, eg.:

likelihood = Gaussian(
    model = DataModelInterface(...)
)

likelihood.loglike(theory_params, sys_params)

Versioning

From v0.1.0, pspec_likelihood will be using strict semantic versioning, such that increases in the major version have potential API breaking changes, minor versions introduce new features, and patch versions fix bugs and other non-breaking internal changes.

If your package depends on pspec_likelihood, set the dependent version like this:

pspec_likelihood>=0.1

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

pspec_likelihood-0.2.0.tar.gz (2.0 MB view details)

Uploaded Source

Built Distribution

pspec_likelihood-0.2.0-py2.py3-none-any.whl (88.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pspec_likelihood-0.2.0.tar.gz.

File metadata

  • Download URL: pspec_likelihood-0.2.0.tar.gz
  • Upload date:
  • Size: 2.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.2 readme-renderer/37.3 requests/2.28.1 requests-toolbelt/0.10.1 urllib3/1.26.11 tqdm/4.64.1 importlib-metadata/5.0.0 keyring/23.13.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.6

File hashes

Hashes for pspec_likelihood-0.2.0.tar.gz
Algorithm Hash digest
SHA256 83e61ba24b64381e37fd921f0aaba89a7bf8126146172a5d5951e68bb6338e43
MD5 425c61997e428053e63ce7753e28ec43
BLAKE2b-256 85128be0e9fe96489c097e421606455a5d55f654142cd3b81c25c7ed4dc6e4dc

See more details on using hashes here.

File details

Details for the file pspec_likelihood-0.2.0-py2.py3-none-any.whl.

File metadata

  • Download URL: pspec_likelihood-0.2.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 88.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.2 readme-renderer/37.3 requests/2.28.1 requests-toolbelt/0.10.1 urllib3/1.26.11 tqdm/4.64.1 importlib-metadata/5.0.0 keyring/23.13.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.6

File hashes

Hashes for pspec_likelihood-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 13971229cae5c74222f556e4779c093f38d04da05b67ff2cf04e15d137c7489b
MD5 894345c73c9b058a4c0747a3284332de
BLAKE2b-256 8357bf84ebddacacca5ca50691c5bb3b8e733525c0c49a12150cd6086a897858

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