A python package for simulating populations of gravitational-wave sources.
Project description
gwmock-pop
gwmock-pop is a Python package for simulating populations of
gravitational-wave sources.
Current package surface
- Protocols:
GWPopSimulator(population simulators),ExternalPopulationLoader(catalogue loaders). - Graph-driven sampling:
GraphSimulatorfrom a YAML/TOMLparametersgraph (packaged presets vialist_presets()/GraphSimulator.from_preset). - Graph-backed CBC simulators:
CBCSimulator,BBHSimulator,BNSSimulator, andNSBHSimulator— configurable priors built on the graph engine; override any parameter's distribution via theparameters=argument. - Composition:
MixtureSimulator,PoissonEventSampler(event-count helper used in mixture workflows). - Catalogues:
FilePopulationLoaderandread_population_catalogue/write_population_cataloguefor CSV and HDF5 (structured or group-of-datasets layouts), including remote URL loading with local caching and CBC canonicalization in the loader. - Quality checks:
validate_samplefor arrays returned by simulators.
Public re-exports live in gwmock_pop.__all__; full module reference is in the
API docs.
Requirements
- Python
>=3.12(tested on 3.12–3.14) - Linux, macOS, or Windows
Installation
Install from PyPI:
uv venv --python 3.12
source .venv/bin/activate # Windows: .venv\Scripts\activate
uv pip install gwmock-pop
Install from source:
git clone git@github.com:Leuven-Gravity-Institute/gwmock-pop.git
cd gwmock-pop
uv venv --python 3.12
source .venv/bin/activate # Windows: .venv\Scripts\activate
uv sync --no-dev
Developer setup:
uv sync --group dev
uv run prek install
Docs setup:
uv sync --group docs
uv run zensical serve
Getting started (CLI)
The gwmock-pop CLI uses Typer. Typical flow: pick a packaged preset or
a graph config file, set the sample count, and write a CSV or HDF5
catalogue.
# Packaged preset (see `gwmock-pop list` for names)
gwmock-pop simulate --config gwtc4 --n 1000 --output population.csv --seed 42
# Or a graph YAML/TOML (top-level `parameters:` as in `examples/gwtc4/bbh_population.yaml`)
gwmock-pop simulate --config examples/gwtc4/bbh_population.yaml --n 500 --output out.h5
Other commands:
| Command | Purpose |
|---|---|
gwmock-pop convert |
Convert population files between CSV and HDF5; optional --column-map JSON/YAML |
gwmock-pop validate |
Check a graph config without sampling |
gwmock-pop inspect |
Summary statistics for a population file |
gwmock-pop list |
List presets and public simulator classes |
gwmock-pop --help
gwmock-pop simulate --help
Getting started (library)
from gwmock_pop import CBCSimulator
sim = CBCSimulator(seed=42)
population = sim.simulate(100)
assert population["detector_frame_mass_1"].shape == (100,)
Use GraphSimulator.from_config_file(...) or GraphSimulator.from_preset(...)
for full graph configs (see examples/ and gwmock_pop.simulators.graph).
FilePopulationLoader also accepts http://, https://, s3://, and
zenodo://<record>/<file> sources. Remote catalogues are cached under
${GWMOCK_POP_CACHE_DIR} or ${XDG_CACHE_HOME:-~/.cache}/gwmock-pop, and CBC
catalogues are validated and rewritten to canonical gwmock-pop parameter names
before sampling.
Verification
gwmock-pop --help
python -c "import gwmock_pop; print(gwmock_pop.__version__)"
Testing
Default test run excludes integration-marked tests:
uv run pytest
Run integration tests explicitly:
uv run pytest -m integration
Documentation
- Site: https://leuven-gravity-institute.github.io/gwmock-pop/
- API index (tables + navigation): docs/api/index.md
- User guide: docs/user_guide/installation.md, docs/user_guide/quick_start.md
License
BSD 3-Clause, see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gwmock_pop-0.9.1.tar.gz.
File metadata
- Download URL: gwmock_pop-0.9.1.tar.gz
- Upload date:
- Size: 238.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.18 {"installer":{"name":"uv","version":"0.11.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d76d275cc47f9092b02b9c58b7ae2f7023729964750484fffc2583f649a0f86
|
|
| MD5 |
3c85bf09103efe7df2f5f8bcc1651da0
|
|
| BLAKE2b-256 |
297bdbecfba6a609adc72ad5ce4c2c2c4fe4ae85e4ba7937fed32bea72e277a9
|
File details
Details for the file gwmock_pop-0.9.1-py3-none-any.whl.
File metadata
- Download URL: gwmock_pop-0.9.1-py3-none-any.whl
- Upload date:
- Size: 100.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.18 {"installer":{"name":"uv","version":"0.11.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16bd402ff626997324518bec7e83463422b36d4f0aec25d0295cf926059994be
|
|
| MD5 |
d97046c6f5bd15c749274e1f1edbf3bf
|
|
| BLAKE2b-256 |
0bebd01e01defcd9e5a0832d6dfcd1c0866ae7878de369e2bf339f6e58cfc36f
|