Fast, smooth corner plots for MCMC chains.
Project description
cornetto
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 — a JAX-based
FFT-KDE library — so contours are smooth and rendering stays fast even at
50k+ samples.
Install
pip install cornetto
Requires Python ≥ 3.10, NumPy, Matplotlib, SciPy, and KDExpress.
Usage
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:
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:
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.
License
MIT — 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 cornetto-0.2.0.tar.gz.
File metadata
- Download URL: cornetto-0.2.0.tar.gz
- Upload date:
- Size: 38.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
436973368d569135fa07bf8d11e0c8c9b435286ce49ef5a445eff5e182d5cbd3
|
|
| MD5 |
7c5b16dd89c2982733e1adef918b4dc4
|
|
| BLAKE2b-256 |
fdbc6aef80944792eda6eeacabc2b9d2cf8dbb9fbdcb9c2d8914abcce37ade0f
|
Provenance
The following attestation bundles were made for cornetto-0.2.0.tar.gz:
Publisher:
publish.yml on nicoborghi/cornetto
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cornetto-0.2.0.tar.gz -
Subject digest:
436973368d569135fa07bf8d11e0c8c9b435286ce49ef5a445eff5e182d5cbd3 - Sigstore transparency entry: 1356939104
- Sigstore integration time:
-
Permalink:
nicoborghi/cornetto@1198003fed54a824af1b90dc863248dc10c6ab2d -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/nicoborghi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1198003fed54a824af1b90dc863248dc10c6ab2d -
Trigger Event:
push
-
Statement type:
File details
Details for the file cornetto-0.2.0-py3-none-any.whl.
File metadata
- Download URL: cornetto-0.2.0-py3-none-any.whl
- Upload date:
- Size: 34.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d8da95991fb2616f5fd809325f505b8dd0cd3f5ce58c65a768e1a9505e1445d
|
|
| MD5 |
3d6bfe7243e84f5d24233c835d5b144c
|
|
| BLAKE2b-256 |
0726effb416df6650241bcc763ad87a71973b7478ddf373e3dd9e5e8e36d4816
|
Provenance
The following attestation bundles were made for cornetto-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on nicoborghi/cornetto
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cornetto-0.2.0-py3-none-any.whl -
Subject digest:
7d8da95991fb2616f5fd809325f505b8dd0cd3f5ce58c65a768e1a9505e1445d - Sigstore transparency entry: 1356939132
- Sigstore integration time:
-
Permalink:
nicoborghi/cornetto@1198003fed54a824af1b90dc863248dc10c6ab2d -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/nicoborghi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1198003fed54a824af1b90dc863248dc10c6ab2d -
Trigger Event:
push
-
Statement type: