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.2.1.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

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

nessai_bilby-0.2.1-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file nessai_bilby-0.2.1.tar.gz.

File metadata

  • Download URL: nessai_bilby-0.2.1.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nessai_bilby-0.2.1.tar.gz
Algorithm Hash digest
SHA256 fd550dff9158c72b0cdc67d212238d4b9d7eeb1a5b9b3661a2ae96d45fc961ec
MD5 f61d92d784e28a12b9ee610ee9b47291
BLAKE2b-256 72b8cdbc365cf3d4ebcada23456d9c7cb9859b2d16612dc5deb764a843f0f475

See more details on using hashes here.

Provenance

The following attestation bundles were made for nessai_bilby-0.2.1.tar.gz:

Publisher: publish.yml on bilby-dev/nessai-bilby

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nessai_bilby-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: nessai_bilby-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nessai_bilby-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 49390d8db0c81e183a20ee59bb2dac4e3146a3c6430ff4be4cfaccde75e8b675
MD5 b963865c80a86fa5b971481afc43628b
BLAKE2b-256 39deb24af8c8c15b36c4532087aa70d47ef2aedf397596c53cf99e163f1ffcb0

See more details on using hashes here.

Provenance

The following attestation bundles were made for nessai_bilby-0.2.1-py3-none-any.whl:

Publisher: publish.yml on bilby-dev/nessai-bilby

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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