Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

sequince-bilby

Interface and plugin for using sequince with bilby.

The plugin provides the following samplers via bilby:

  • sequince-smc: standard sequential Monte Carlo
  • sequince-ps: persistent sampling

Installation

Install sequince-bilby with pip (Python 3.11 or newer is required):

pip install sequince-bilby

For development setup, see the contributing guidelines.

Usage

See the Bilby documentation for guidance on defining likelihoods and priors, running analyses, and working with results.

Once installed, select a sampler with bilby.run_sampler:

import bilby

likelihood = ...
priors = ...

result = bilby.run_sampler(
    likelihood=likelihood,
    priors=priors,
    sampler="sequince-smc",
    n_particles=500,
)

Use sampler="sequince-ps" for persistent sampling. Keyword arguments are forwarded to the corresponding Sequince prebuilt sampler. See the Bilby documentation for likelihoods, priors, and results.

Parallelization

For NumPy sampling, set npool to the number of worker processes:

result = bilby.run_sampler(
    likelihood=likelihood,
    priors=priors,
    sampler="sequince-smc",
    npool=4,
)

Array backends

Sampling uses NumPy by default and supports released Bilby 2.8. JAX and PyTorch require an array-aware development version of Bilby, the corresponding backend package, and priors and likelihoods that support that backend.

Enable array API support before importing Bilby:

export BILBY_ARRAY_API=1
export SCIPY_ARRAY_API=1
export JAX_ENABLE_X64=1  # For JAX double precision.

Select the backend with sampler_backend:

result = bilby.run_sampler(
    likelihood=likelihood,
    priors=priors,
    sampler="sequince-smc",
    sampler_backend="jax",
    npool=1,
    map_fn="vmap",
    jit=True,
    sampling_seed=1234,
)

Backend sampling requires npool=1 without a pool. Use map_fn="vmap" for vectorized likelihood evaluation; the likelihood must support the backend's vectorization. For JAX, jit=True compiles the callback and requires traceable priors and likelihoods. These options do not compile the full sampler loop. Omit map_fn and jit to use the default mapping.

PyTorch support is experimental: the tested Bilby development version can fail during prior normalization for particles outside prior support. CuPy is not supported.

Run the backend example with the optional bilby-main development environment:

pixi run -e bilby-main example-backends --backend jax

Reproducibility

Use sampling_seed for reproducible runs on a given backend. You can also pass a generator with rng. Without either, sampling uses Bilby's random generator. Different backends use different random streams.

When resuming, use the same backend as the checkpoint. The saved RNG state takes precedence over a new seed or generator.

Checkpointing

HDF5 checkpointing and resume are enabled by default. The default checkpoint is <outdir>/<label>_<sampler>_checkpoint.h5.

result = bilby.run_sampler(
    likelihood=likelihood,
    priors=priors,
    sampler="sequince-ps",
    checkpoint=True,
    checkpoint_filename="checkpoint.h5",
    checkpoint_frequency=10,
    resume=True,
)

Set checkpoint=False or resume=False to disable either behavior.

Samples

result.posterior contains equal-weight samples obtained by rejection sampling. The full particle population and its normalized weights are stored in result.nested_samples. The complete Sequince result is also saved as an HDF5 file in outdir.

Citing

If you use sequince-bilby in scientific work, please cite Sequince and Bilby. Follow Bilby's citation guidance for the Bilby paper, the DOI for the version used, and any additional references relevant to your analysis.

If you use sequince-ps, please also cite the persistent sampling paper. For gravitational-wave analyses, please also cite arXiv:2506.18977.

Contributing

Bug reports, feature requests, and pull requests are welcome via the GitHub repository. Please see the contributing guidelines and Sequince's AI policy.

The following repositories are part of the sequince ecosystem:

  • sequince: provides modular sequential Monte Carlo samplers and reusable sampling components
  • sequince-density: provides density estimators for preconditioned SMC and ASPIRE-style analyses
  • sequince-examples: provides examples demonstrating Sequince's features
  • orng: provides cross-backend random number generation
  • acai: provides array-API compatible control flow and iteration

License

Licensed under the MIT License.

Metadata

Release files for sequince-bilby 0.1.0b1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sequince-bilby 0.1.0b1
File Size Uploaded Provenance Actions
sequince_bilby-0.1.0b1.tar.gz 32.6 kB With provenance Details for sequince_bilby-0.1.0b1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sequince-bilby 0.1.0b1
File Interpreter ABI Platform Actions
sequince_bilby-0.1.0b1-py3-none-any.whl Python 3 none any Details for sequince_bilby-0.1.0b1-py3-none-any.whl

Total release size: 46.0 kB

Release files / sequince_bilby-0.1.0b1.tar.gz

Download URL sequince_bilby-0.1.0b1.tar.gz
Size 32.6 kB
Tags Source
SHA-256 checksum
How to use checksums
96cfd8debbee453e4f8bbe4489662574bf43b767e06526426754d71a68d4c810
BLAKE2b-256 checksum
How to use checksums
a9e4ce4acdc96ae390de4dad2097bc8cba36ac92853da59410aed4b8ebbe678f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Release files / sequince_bilby-0.1.0b1-py3-none-any.whl

Download URL sequince_bilby-0.1.0b1-py3-none-any.whl
Size 13.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a2bff8a2ca6fa155ed4c522cd94d6222255727048c14175d06a11a6bf75ebcb6
BLAKE2b-256 checksum
How to use checksums
54627a3b3b730ef848417d2f10f7bbb3b9eda57dc359584b6cde0e2eb8ddb668
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Security for sequince-bilby 0.1.0b1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sequince_bilby-0.1.0b1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page