Metadata-Version: 2.4
Name: gwmock-pop
Version: 0.6.1
Summary: A python package for simulating populations of gravitational-wave sources.
Project-URL: Documentation, https://leuven-gravity-institute.github.io/gwmock-pop/
Project-URL: Source, https://github.com/Leuven-Gravity-Institute/gwmock-pop
Project-URL: Tracker, https://github.com/Leuven-Gravity-Institute/gwmock-pop/issues
Project-URL: Home, https://github.com/Leuven-Gravity-Institute/gwmock-pop
Project-URL: Release Notes, https://github.com/Leuven-Gravity-Institute/gwmock-pop/releases
Author: Isaac C. F. Wong
License: Copyright (c) 2026, Leuven Gravity Institute
        
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without modification,
        are permitted provided that the following conditions are met:
        
            * Redistributions of source code must retain the above copyright notice,
              this list of conditions and the following disclaimer.
            * Redistributions in binary form must reproduce the above copyright notice,
              this list of conditions and the following disclaimer in the documentation
              and/or other materials provided with the distribution.
            * Neither the name of gwmock-pop nor the names of its contributors
              may be used to endorse or promote products derived from this software
              without specific prior written permission.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
        "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
        LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
        A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
        CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
        EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
        PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
        PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
        LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
        NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
        SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.12
Requires-Dist: h5py>=3.16.0
Requires-Dist: jax>=0.10.0
Requires-Dist: networkx>=3.6.1
Requires-Dist: pydantic>=2.13.3
Requires-Dist: pyyaml>=6.0.3
Requires-Dist: ruyaml>=0.91.0
Requires-Dist: typer>=0.25.1
Description-Content-Type: text/markdown

# gwmock-pop

[![Python CI](https://github.com/Leuven-Gravity-Institute/gwmock-pop/actions/workflows/ci.yml/badge.svg)](https://github.com/Leuven-Gravity-Institute/gwmock-pop/actions/workflows/ci.yml)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/Leuven-Gravity-Institute/gwmock-pop/main.svg)](https://results.pre-commit.ci/latest/github/Leuven-Gravity-Institute/gwmock-pop/main)
[![Documentation Status](https://github.com/Leuven-Gravity-Institute/gwmock-pop/actions/workflows/documentation.yml/badge.svg)](https://leuven-gravity-institute.github.io/gwmock-pop/)
[![codecov](https://codecov.io/gh/leuven-gravity-institute/gwmock-pop/graph/badge.svg?token=Vwf7NYTHCm)](https://codecov.io/gh/leuven-gravity-institute/gwmock-pop)
[![PyPI Version](https://img.shields.io/pypi/v/gwmock-pop)](https://pypi.org/project/gwmock-pop/)
[![Python Versions](https://img.shields.io/pypi/pyversions/gwmock-pop)](https://pypi.org/project/gwmock-pop/)
[![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](LICENSE)
[![Security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit)
[![DOI](https://zenodo.org/badge/1147941311.svg)](https://doi.org/10.5281/zenodo.18574076)
[![SPEC 0 — Minimum Supported Dependencies](https://img.shields.io/badge/SPEC-0-green?labelColor=%23004811&color=%235CA038)](https://scientific-python.org/specs/spec-0000/)

`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:** `GraphSimulator` from a YAML/TOML `parameters`
  graph (packaged **presets** via `list_presets()` /
  `GraphSimulator.from_preset`).
- **Lightweight CBC priors:** `CBCPriorSimulator`, `BNSPriorSimulator`,
  `NSBHPriorSimulator`, and `BBHSimulator` for tests and baselines.
- **Composition:** `MixtureSimulator`, `PoissonEventSampler` (event-count helper
  used in mixture workflows).
- **Catalogues:** `FilePopulationLoader` and `read_population_catalogue` /
  `write_population_catalogue` for CSV and HDF5 (structured or group-of-datasets
  layouts).
- **Quality checks:** `validate_sample` for arrays returned by simulators.

Public re-exports live in `gwmock_pop.__all__`; full module reference is in the
**[API docs](docs/api/index.md)**.

## Requirements

- Python `>=3.12` (tested on 3.12–3.14)
- Linux, macOS, or Windows

## Installation

Install from PyPI:

```bash
uv venv --python 3.12
source .venv/bin/activate  # Windows: .venv\Scripts\activate
uv pip install gwmock-pop
```

Install from source:

```bash
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:

```bash
uv sync --group dev
uv run pre-commit install
```

Docs setup:

```bash
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.

```bash
# 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                                        |

```bash
gwmock-pop --help
gwmock-pop simulate --help
```

## Getting started (library)

```python
from gwmock_pop import CBCPriorSimulator

sim = CBCPriorSimulator(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`).

## Verification

```bash
gwmock-pop --help
python -c "import gwmock_pop; print(gwmock_pop.__version__)"
```

## Testing

Default test run excludes `integration`-marked tests:

```bash
uv run pytest
```

Run integration tests explicitly:

```bash
uv run pytest -m integration
```

## Documentation

- **Site:**
  [https://leuven-gravity-institute.github.io/gwmock-pop/](https://leuven-gravity-institute.github.io/gwmock-pop/)
- **API index (tables + navigation):** [docs/api/index.md](docs/api/index.md)
- **User guide:**
  [docs/user_guide/installation.md](docs/user_guide/installation.md),
  [docs/user_guide/quick_start.md](docs/user_guide/quick_start.md)

## License

BSD 3-Clause, see [LICENSE](LICENSE).
