Welcome to discoverysamplers documentation!

discoverysamplers is a collection of bridge interfaces that connect Discovery (a JAX-based Pulsar Timing Array analysis framework) to various nested sampling and MCMC samplers.

Author

Jonas El Gammal

Source

Source code on GitHub

Documentation

Documentation on Read the Docs

License

MIT

Support

For questions, use GitHub Issues or drop me an email

Installation

Clone from GitHub

Overview

The package provides lightweight wrappers that adapt Discovery-style models (callables accepting parameter dictionaries) to the APIs expected by different sampling backends.

Key Features

  • Unified Interface: Consistent API across multiple sampling backends

  • Flexible Prior Specification: Support for multiple prior formats (dicts, tuples, callables)

  • JAX Integration: Optional JIT compilation for improved performance

  • Parameter Management: Automatic handling of fixed vs. sampled parameters

  • LaTeX Labels: Built-in support for publication-quality plotting

Supported Samplers

Sampler

Type

Key Features

Eryn

MCMC (Ensemble)

Parallel tempering, reversible-jump MCMC support

Nessai

Nested Sampling

Flow-based proposals, importance nested sampling

JAX-NS

Nested Sampling

Pure JAX implementation, vectorized likelihood evaluation

GPry

GP Emulation

Gaussian Process surrogate model with active learning

Quick Start

Install the package:

git clone https://github.com/jonaselgammal/discoverysamplers.git
cd discoverysamplers
pip install .

Basic usage with Nessai:

from discoverysamplers import DiscoveryNessaiBridge

# Define your model
def my_model(params):
    return -0.5 * (params['x']**2 + params['y']**2)

# Define priors
priors = {
    'x': ('uniform', -5.0, 5.0),
    'y': ('uniform', -5.0, 5.0),
}

# Create bridge and run sampler
bridge = DiscoveryNessaiBridge(my_model, priors)
results = bridge.run_sampler(nlive=1000, output='output/')

See the Quick Start Guide for more detailed examples.

Citation

If you use discoverysamplers in your research, please cite:

@software{discoverysamplers,
  author = {El Gammal, Jonas},
  title = {discoverysamplers: Tools for Bayesian inference with Discovery},
  year = {2025},
  url = {https://github.com/jonaselgammal/discoverysamplers}
}

Documentation Contents

Acknowledgements

Indices and tables