BAHAMAS
Bahamas: BAyesian inference with HAmiltonian Montecarlo for Astrophysical Stochastic background.
BAHAMAS is a Python package for the inference of stochastic gravitational wave background signals (SGWB) using Hamiltonian Markov Chain Monte Carlo (HMCMC) as implemented in NumPyro, which relies on JAX for automatic differentiation and JIT compilation to GPU/CPU.
BAHAMAS is under active development, so be aware of potential brittleness, bugs, and changes to the API as the design evolves.
Documentation available at: Bahamas docs
Features
The package includes two main command-line interfaces:
-
bahamas_data: Data simulation and preprocessing. -
bahamas_inference: Parameter estimation and minimal diagnostics -
bahamas_input: From LISA data challange dataset (e.g. yorsh) to bahamas
Both scripts require two input files:
-
--config config.yaml: Specifies the simulation and inference settings, sampler configuration, and output paths. -
--sources sources.yaml: Defines the sources to be injected and/or recovered. This includes the true physical parameters of the sources as well as the prior ranges used for inference.
The data consist of two datastreams—the A and E channels—which are specific combinations of Time-Delay Interferometry (TDI) variables. In bahamas, the data are generated in the frequency domain, chunk by chunk. This represents a simplification, as it neglects potential biases arising in the time domain, such as windowing effects and spectral leakage. The duration of each chunk—and consequently the frequency resolution—can be configured via config.yaml. However, we recommend not using time lengths shorter than $10^4 \mathrm{s}$, which corresponds to a frequency resolution of approximately $\Delta f \sim 0.1 \mathrm{mHz}$, below which the characterization of LISA's instrumental noise is not guaranteed.
The algorithm also allows for the analysis of stationary, isotropic, and Gaussian stochastic process (e.g., a signal characterized by a power-law power spectral density), enabling the evaluation of the impact of multiple overlapping sources.
We also provide the option to include data gaps, which represent periods during the mission when no useful data are available. These gaps can occur due to scheduled maintenance (scheduled gaps) or unforeseen hardware issues (unscheduled gaps). The goal is not to mitigate the impact of these interruptions but rather to characterize their effect on the reconstruction of stochastic signals.
The algorithm provides flexibility to perform analyses with either full-resolution data or coarse-grained data over different chunks. In the former case, the likelihood describing the data follows a Whittle distribution in each segment, while in the latter, it collapses to a Gamma distribution with degrees of freedom equal to the number of bins used in the averaging process.
Sources
This plot shows the types of signals you can simulate using bahamas. The galactic foreground can be generated and analyzed in both stationary and non-stationary assumption.
Notebooks
In the data folder, you can find two example notebooks:
-
example_bahamas: A minimal example demonstrating how to use bahamas. -
example_modulation: This notebook shows how the modulation model implemented in bahamas accounts for the non-stationarity of the galactic foreground. Feel free to play with the parameters and observe how the modulation changes!
Installation
You can install BAHAMAS from source:
git clone https://github.com/fede121/bahamas.git
cd bahamas
pip install .
or directly from the PyPI package available here
pip install bahamas
License
This project is open-source and available under the Apache License 2.0.
For more information, examples, or to contribute, please visit the GitHub repository.
Metadata
Release files for bahamas 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bahamas-0.1.2.tar.gz | 42.6 kB | With provenance | Details for bahamas-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bahamas-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for bahamas-0.1.2-py3-none-any.whl |
Total release size: 91.4 kB
Release files / bahamas-0.1.2.tar.gz
| Download URL | bahamas-0.1.2.tar.gz |
|---|---|
| Size | 42.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a89fe4c2a5d670c9ac5042da965541de0247922daf4172ad8763d91e16e39f9f
|
|
BLAKE2b-256 checksum How to use checksums |
6d0403f69b3edf2a80b9a90f310e3bbe9e94e86739884ef6e85a0c503bb9a2a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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 Aug 25, 2025.
Transparency logRelease files / bahamas-0.1.2-py3-none-any.whl
| Download URL | bahamas-0.1.2-py3-none-any.whl |
|---|---|
| Size | 48.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a7dda7df2518bd92dc275b75928bab2eef0ff7b669a5e02be9e00b29a0dabeb2
|
|
BLAKE2b-256 checksum How to use checksums |
cde3518964c9607e464621d7c576da08324b569cac06f08b60eb896e48efd9f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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 Aug 25, 2025.
Transparency logSecurity for bahamas 0.1.2
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
All 2 files in this release have been uploaded with provenance metadata.
Attestation for bahamas-0.1.2.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 Aug 25, 2025.
Transparency logA 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.