# gwcosmo Documentation

This directory contains the Sphinx documentation for gwcosmo.

## Building the Documentation

### Prerequisites

Install the documentation dependencies:

```bash
pip install -r requirements.txt
```

### Build HTML Documentation

```bash
# From the docs directory
make html

# Or using sphinx-build directly
sphinx-build -b html . _build/html
```

The built documentation will be in `_build/html/`. Open `_build/html/index.html` in a browser to view it.

### Clean Build Files

```bash
make clean
```

## Documentation Structure

- `index.rst` - Main documentation index
- `installation.md` - Installation guide
- `data.md` - Data requirements
- `cosmological-inference.md` - Main usage guide
- `bright-siren-example.md` - Bright siren tutorial
- `dark-siren-example.md` - Dark siren tutorial
- `los-prior.md` - LOS redshift prior guide
- `injections.md` - Injection generation guide
- `api/` - Auto-generated API documentation from docstrings
- `api.rst` - API reference index

## Configuration

The Sphinx configuration is in `conf.py`. Key settings:

- **Extensions**: autodoc, autosummary, napoleon, viewcode, intersphinx, myst_parser
- **Theme**: sphinx_rtd_theme (ReadTheDocs theme)
- **Autodoc**: Configured to automatically document all members with type hints
- **Napoleon**: Supports both Google and NumPy style docstrings
- **Intersphinx**: Links to Python, NumPy, SciPy, Astropy, and Bilby documentation

## API Documentation

The API documentation is automatically generated from docstrings in the source code using Sphinx autodoc. The structure is:

- `api.rst` - Main API reference page
- `api/likelihood.rst` - Likelihood module documentation
- `api/prior.rst` - Prior module documentation
- `api/utilities.rst` - Utilities module documentation
- `api/injections.rst` - Injections module documentation
- `api/maps.rst` - Maps module documentation
- `api/plotting.rst` - Plotting module documentation

To update the API documentation, simply update the docstrings in the source code and rebuild the documentation.
