Skip to main content

Interface and plugin for using nessai in bilby

Project description

nessai-bilby

Interface and plugin for using nessai in bilby.

This plugin provides two samplers that can be used in bilby:

  • nessai: the standard nested sampler from nessai
  • inessai: the importance nested sampler from nessai

It also provides a means to use bilby likelihoods and priors directly in nessai, see using bilby likelihoods in nessai

Installation

The package can be installed using pip

pip install nessai-bilby

or conda

conda install conda-forge::nessai-bilby

However, we recommend following installing PyTorch manually to ensure the correct device support.

Note: this plugin requires "bilby>=2.3.0".

Usage

In bilby

One nessai-bilby is installed, both samplers can be used directly in bilby via the run_sampler function. See the bilby documentation for more details on how to run different samplers.

Using bilby likelihoods in nessai

nessai-bilby also provides two model classes that allow bilby likelihood and priors to be used directly with nessai:

  • nessai_bilby.model.BilbyModel:
  • nessai_bilby.model.BilbyModelLikelihoodConstraint:

Either model can be used by creating an instance of the model and running nessai as usual:

from nessai.flowsampler import FlowSampler
from nessai_bilby.model import BilbyModel

likelihood = ...    # bilby likelihood object
priors = ... # bilby PriorDict

model = BilbyModel(
    priors=priors,
    likelihood=likelihood,
    use_ratio=True    # Whether to use the log-likelihood ratio
)

fs = FlowSampler(
    model,
    ...,
)

fs.run()

Citing

If you use nessai-bilby, please cite the nessai and bilby code bases and the corresponding papers.

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

nessai_bilby-0.1.0.post0.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

nessai_bilby-0.1.0.post0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file nessai_bilby-0.1.0.post0.tar.gz.

File metadata

  • Download URL: nessai_bilby-0.1.0.post0.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for nessai_bilby-0.1.0.post0.tar.gz
Algorithm Hash digest
SHA256 29d180a334d4f2135a92170b40ab5faef53771b5019b690ba0eaa936b1026004
MD5 08430f6494edf2eb79a7de804d6f4621
BLAKE2b-256 fc20cdd6ceb54c59c62d411b46b53b1a56ff56ee25f487c0a773989d7f9c97ea

See more details on using hashes here.

File details

Details for the file nessai_bilby-0.1.0.post0-py3-none-any.whl.

File metadata

File hashes

Hashes for nessai_bilby-0.1.0.post0-py3-none-any.whl
Algorithm Hash digest
SHA256 10d3bbbacdf159cadda24ccb7af1de94371fb070e1fc739e903d6ca7ed352739
MD5 b7823936fc4ee0bf1a81f1a30a4d5efe
BLAKE2b-256 518866d2d32b9ac55313660521b501d685b121f66c5b3e928850da9bd8fe7dd9

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