Metadata-Version: 2.4
Name: cornetto
Version: 0.2.0
Summary: Fast, smooth corner plots for MCMC chains.
Author: Nicola Borghi
License: MIT License
        
        Copyright (c) 2026 Nicola Borghi and cornetto contributors
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/nicoborghi/cornetto
Project-URL: Documentation, https://github.com/nicoborghi/cornetto#readme
Project-URL: Issues, https://github.com/nicoborghi/cornetto/issues
Project-URL: Source, https://github.com/nicoborghi/cornetto
Keywords: corner-plot,posterior,bayesian,kde,visualization,matplotlib,gravitational-waves
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Astronomy
Classifier: Topic :: Scientific/Engineering :: Visualization
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.24
Requires-Dist: matplotlib>=3.7
Requires-Dist: scipy>=1.10
Requires-Dist: KDExpress>=0.1.0
Provides-Extra: dev
Requires-Dist: pytest>=7; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Provides-Extra: docs
Requires-Dist: mkdocs-material>=9.5; extra == "docs"
Requires-Dist: pymdown-extensions>=10.7; extra == "docs"
Requires-Dist: mkdocs-gallery>=0.10; extra == "docs"
Requires-Dist: mkdocs-jupyter>=0.25; extra == "docs"
Requires-Dist: ipykernel>=6; extra == "docs"
Requires-Dist: datashader>=0.15; extra == "docs"
Requires-Dist: pandas>=1.5; extra == "docs"
Provides-Extra: latex
Requires-Dist: astropy>=5; extra == "latex"
Provides-Extra: datashader
Requires-Dist: datashader>=0.15; extra == "datashader"
Requires-Dist: pandas>=1.5; extra == "datashader"
Dynamic: license-file

# cornetto

[![Tests](https://img.shields.io/github/actions/workflow/status/nicoborghi/cornetto/tests.yml?label=Tests&logo=github&logoColor=white)](https://github.com/nicoborghi/cornetto/actions)
[![PyPI](https://img.shields.io/pypi/v/cornetto)](https://pypi.org/project/cornetto/)
[![Python](https://img.shields.io/pypi/pyversions/cornetto)](https://pypi.org/project/cornetto/)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue)](https://github.com/nicoborghi/cornetto/blob/main/LICENSE)
[![Coverage](https://img.shields.io/codecov/c/github/nicoborghi/cornetto)](https://codecov.io/gh/nicoborghi/cornetto)
[![Built with Claude](https://img.shields.io/badge/built_with-Claude-orange?logo=anthropic&logoColor=white)](https://claude.ai)

**Fast, smooth corner plots for MCMC chains.**

> [!NOTE]
> **Early release** — cornetto is built for research use and works well for everyday analysis, but the API may still evolve and some features are still maturing. Feedback and contributions are very welcome.

Cornetto takes a `dict[str, array]` of posterior samples and produces
publication-ready corner plots. Under the hood it uses
[KDExpress](https://github.com/mtagliazucchi/KDExpress) — a JAX-based
FFT-KDE library — so contours are smooth and rendering stays fast even at
50k+ samples.

<p align="center">
  <img src="docs/example_cornetto.svg" alt="cornetto corner plot" width="500">
</p>

## Install

```bash
pip install cornetto
```

Requires Python ≥ 3.10, NumPy, Matplotlib, SciPy, and
[KDExpress](https://pypi.org/project/KDExpress/).

## Usage

```python
import numpy as np
from cornetto import corner

# data is a plain dict: parameter name → 1-D sample array
data = {
    "mass_1": chain["mass_1"],   # shape (N_samples,)
    "mass_2": chain["mass_2"],
    "chi_eff": chain["chi_eff"],
}

fig, axes = corner(
    data,
    labels={"mass_1": r"$m_1\,[M_\odot]$",
            "mass_2": r"$m_2\,[M_\odot]$",
            "chi_eff": r"$\chi_{\mathrm{eff}}$"},
    truths={"mass_1": 35.6},
    chain_labels=["GW200129"],
)
fig.savefig("posterior.pdf", bbox_inches="tight")
```

Multiple chains (e.g. two events, or prior vs posterior) are just 2-D arrays:

```python
data = {
    "mass_1": np.stack([chain_A["mass_1"], chain_B["mass_1"]]),  # (2, N)
    "mass_2": np.stack([chain_A["mass_2"], chain_B["mass_2"]]),
}
corner(data, chain_labels=["GW150914", "GW190521"])
```

For fast iteration during analysis, `quick_corner` skips KDE entirely:

```python
from cornetto import quick_corner
fig, axes = quick_corner(data)   # histograms only, sub-second
```

## Documentation

Full guide, API reference, and benchmarks at
**[cornetto.readthedocs.io](https://cornetto.readthedocs.io)**.

## License

MIT — see [LICENSE](LICENSE).
