corner 2.2.3rc1__tar.gz → 2.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {corner-2.2.3rc1 → corner-2.3.0}/.github/workflows/tests.yml +36 -39
- {corner-2.2.3rc1 → corner-2.3.0}/.gitignore +2 -1
- {corner-2.2.3rc1 → corner-2.3.0}/.pre-commit-config.yaml +5 -5
- {corner-2.2.3rc1 → corner-2.3.0}/CONTRIBUTING.md +7 -2
- {corner-2.2.3rc1 → corner-2.3.0}/PKG-INFO +6 -2
- {corner-2.2.3rc1 → corner-2.3.0}/docs/install.rst +3 -5
- {corner-2.2.3rc1 → corner-2.3.0}/docs/pages/arviz.ipynb +12 -4
- corner-2.3.0/docs/pages/sigmas.ipynb +124 -0
- {corner-2.2.3rc1 → corner-2.3.0}/pyproject.toml +7 -3
- {corner-2.2.3rc1 → corner-2.3.0}/readthedocs.yaml +2 -2
- corner-2.3.0/src/corner/__init__.py +22 -0
- {corner-2.2.3rc1 → corner-2.3.0}/src/corner/arviz_corner.py +44 -4
- {corner-2.2.3rc1 → corner-2.3.0}/src/corner/core.py +91 -4
- {corner-2.2.3rc1 → corner-2.3.0}/src/corner/corner.py +5 -5
- corner-2.3.0/src/corner/version.py +24 -0
- corner-2.3.0/tests/baseline_images/test_corner/1d_fig_argument.png +0 -0
- corner-2.3.0/tests/baseline_images/test_corner/arviz.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_corner/basic.png +0 -0
- corner-2.3.0/tests/baseline_images/test_corner/basic_log.png +0 -0
- corner-2.3.0/tests/baseline_images/test_corner/basic_log_x2_only.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_corner/bins.png +0 -0
- corner-2.3.0/tests/baseline_images/test_corner/bins_log.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_corner/color.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_corner/color_filled.png +0 -0
- corner-2.3.0/tests/baseline_images/test_corner/extended_overplotting.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_corner/hist_bin_factor.png +0 -0
- corner-2.3.0/tests/baseline_images/test_corner/hist_bin_factor_log.png +0 -0
- corner-2.3.0/tests/baseline_images/test_corner/labels.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_corner/no_fill_contours.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_corner/overplot.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_corner/overplot_1d.png +0 -0
- corner-2.3.0/tests/baseline_images/test_corner/overplot_log.png +0 -0
- corner-2.3.0/tests/baseline_images/test_corner/pandas.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_corner/quantiles.png +0 -0
- corner-2.3.0/tests/baseline_images/test_corner/quantiles_log.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_corner/range_fig_arg.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_corner/reverse.png +0 -0
- corner-2.3.0/tests/baseline_images/test_corner/reverse_log.png +0 -0
- corner-2.3.0/tests/baseline_images/test_corner/reverse_overplotting.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_corner/reverse_truths.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_corner/smooth.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_corner/smooth1d.png +0 -0
- corner-2.3.0/tests/baseline_images/test_corner/smooth1d_log.png +0 -0
- corner-2.3.0/tests/baseline_images/test_corner/smooth_log.png +0 -0
- corner-2.3.0/tests/baseline_images/test_corner/tight.png +0 -0
- corner-2.3.0/tests/baseline_images/test_corner/title_quantiles.png +0 -0
- corner-2.3.0/tests/baseline_images/test_corner/title_quantiles_default.png +0 -0
- corner-2.3.0/tests/baseline_images/test_corner/title_quantiles_raises.png +0 -0
- corner-2.3.0/tests/baseline_images/test_corner/titles1.png +0 -0
- corner-2.3.0/tests/baseline_images/test_corner/titles2.png +0 -0
- corner-2.3.0/tests/baseline_images/test_corner/titles_fmt_multi.png +0 -0
- corner-2.3.0/tests/baseline_images/test_corner/titles_fmt_single.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_corner/top_ticks.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_corner/truths.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/test_corner.py +71 -7
- corner-2.2.3rc1/docs/pages/sigmas.ipynb +0 -103
- corner-2.2.3rc1/noxfile.py +0 -16
- corner-2.2.3rc1/src/corner/__init__.py +0 -7
- corner-2.2.3rc1/src/corner/version.py +0 -16
- corner-2.2.3rc1/tests/baseline_images/test_corner/1d_fig_argument.png +0 -0
- corner-2.2.3rc1/tests/baseline_images/test_corner/arviz.png +0 -0
- corner-2.2.3rc1/tests/baseline_images/test_corner/basic_log.png +0 -0
- corner-2.2.3rc1/tests/baseline_images/test_corner/basic_log_x2_only.png +0 -0
- corner-2.2.3rc1/tests/baseline_images/test_corner/bins_log.png +0 -0
- corner-2.2.3rc1/tests/baseline_images/test_corner/extended_overplotting.png +0 -0
- corner-2.2.3rc1/tests/baseline_images/test_corner/hist_bin_factor_log.png +0 -0
- corner-2.2.3rc1/tests/baseline_images/test_corner/labels.png +0 -0
- corner-2.2.3rc1/tests/baseline_images/test_corner/overplot_log.png +0 -0
- corner-2.2.3rc1/tests/baseline_images/test_corner/pandas.png +0 -0
- corner-2.2.3rc1/tests/baseline_images/test_corner/quantiles_log.png +0 -0
- corner-2.2.3rc1/tests/baseline_images/test_corner/reverse_log.png +0 -0
- corner-2.2.3rc1/tests/baseline_images/test_corner/reverse_overplotting.png +0 -0
- corner-2.2.3rc1/tests/baseline_images/test_corner/smooth1d_log.png +0 -0
- corner-2.2.3rc1/tests/baseline_images/test_corner/smooth_log.png +0 -0
- corner-2.2.3rc1/tests/baseline_images/test_corner/tight.png +0 -0
- corner-2.2.3rc1/tests/baseline_images/test_corner/title_quantiles.png +0 -0
- corner-2.2.3rc1/tests/baseline_images/test_corner/title_quantiles_default.png +0 -0
- corner-2.2.3rc1/tests/baseline_images/test_corner/title_quantiles_raises.png +0 -0
- corner-2.2.3rc1/tests/baseline_images/test_corner/titles1.png +0 -0
- corner-2.2.3rc1/tests/baseline_images/test_corner/titles2.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/.copier-answers.yml +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/.github/dependabot.yml +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/CODE_OF_CONDUCT.md +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/LICENSE +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/MANIFEST.in +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/README.md +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/corner.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/demo.py +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/docs/.gitignore +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/docs/Makefile +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/docs/_static/corner.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/docs/api.rst +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/docs/conf.py +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/docs/index.md +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/docs/pages/custom.ipynb +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/docs/pages/matplotlibrc +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/docs/pages/quickstart.ipynb +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/paper/corner.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/paper/paper.bib +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/paper/paper.json +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/paper/paper.md +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/paper/paper.tex +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_hist2d/backgroundColor.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_hist2d/backgroundDark.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_hist2d/backgroundDark2.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_hist2d/backgroundSolarized.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_hist2d/basic.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_hist2d/color.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_hist2d/cutoff.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_hist2d/cutoff2.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_hist2d/filled.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_hist2d/levels1.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_hist2d/levels2.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_hist2d/lowN.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_hist2d/lowNfilled.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_hist2d/lowNnofill.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_hist2d/philsplot.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_hist2d/smooth1.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/baseline_images/test_hist2d/smooth2.png +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/conftest.py +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/test_hist2d.py +0 -0
- {corner-2.2.3rc1 → corner-2.3.0}/tests/test_quantile.py +0 -0
|
@@ -15,60 +15,56 @@ jobs:
|
|
|
15
15
|
fail-fast: false
|
|
16
16
|
matrix:
|
|
17
17
|
os: ["ubuntu-latest"]
|
|
18
|
-
python-version: ["3.
|
|
19
|
-
nox-session: ["tests"]
|
|
20
|
-
include:
|
|
21
|
-
- os: ubuntu-latest
|
|
22
|
-
python-version: "3.10"
|
|
23
|
-
nox-session: "lint"
|
|
18
|
+
python-version: ["3.12", "3.14"]
|
|
24
19
|
|
|
25
20
|
steps:
|
|
26
21
|
- name: Checkout
|
|
27
|
-
uses: actions/checkout@
|
|
22
|
+
uses: actions/checkout@v7
|
|
28
23
|
with:
|
|
29
24
|
submodules: true
|
|
30
25
|
fetch-depth: 0
|
|
31
|
-
- name:
|
|
32
|
-
uses:
|
|
26
|
+
- name: Install uv
|
|
27
|
+
uses: astral-sh/setup-uv@d31148d669074a8d0a63714ba94f3201e7020bc3 # v8.3.0
|
|
33
28
|
with:
|
|
34
29
|
python-version: ${{ matrix.python-version }}
|
|
30
|
+
enable-cache: true
|
|
31
|
+
- name: Run tests
|
|
32
|
+
run: uv run pytest -v tests
|
|
33
|
+
- name: Upload generated images on failure
|
|
34
|
+
uses: actions/upload-artifact@v7
|
|
35
|
+
if: ${{ failure() }}
|
|
36
|
+
with:
|
|
37
|
+
name: images-${{ matrix.os }}-${{ matrix.python-version }}
|
|
38
|
+
path: ./result_images
|
|
39
|
+
|
|
40
|
+
lint:
|
|
41
|
+
runs-on: ubuntu-latest
|
|
42
|
+
steps:
|
|
43
|
+
- name: Checkout
|
|
44
|
+
uses: actions/checkout@v7
|
|
45
|
+
- name: Install uv
|
|
46
|
+
uses: astral-sh/setup-uv@d31148d669074a8d0a63714ba94f3201e7020bc3 # v8.3.0
|
|
35
47
|
- name: Cache pre-commit environments
|
|
36
|
-
|
|
37
|
-
uses: actions/cache@v4
|
|
48
|
+
uses: actions/cache@v6
|
|
38
49
|
with:
|
|
39
50
|
path: ~/.cache/pre-commit
|
|
40
51
|
key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
|
|
41
52
|
restore-keys: |
|
|
42
53
|
${{ runner.os }}-pre-commit-
|
|
43
|
-
- name:
|
|
44
|
-
run:
|
|
45
|
-
python -m pip install -U pip
|
|
46
|
-
python -m pip install -U nox
|
|
47
|
-
- name: Run tests
|
|
48
|
-
run: python -m nox --non-interactive -s ${{ matrix.nox-session }}
|
|
49
|
-
- name: Upload generated images on failure
|
|
50
|
-
uses: actions/upload-artifact@v4
|
|
51
|
-
if: ${{ failure() && matrix.nox-session == 'tests' }}
|
|
52
|
-
with:
|
|
53
|
-
name: images-${{ matrix.os }}-${{ matrix.python-version }}
|
|
54
|
-
path: ./result_images
|
|
54
|
+
- name: Run pre-commit
|
|
55
|
+
run: uvx pre-commit run --all-files
|
|
55
56
|
|
|
56
57
|
build:
|
|
57
58
|
runs-on: ubuntu-latest
|
|
58
59
|
steps:
|
|
59
|
-
- uses: actions/checkout@
|
|
60
|
+
- uses: actions/checkout@v7
|
|
60
61
|
with:
|
|
61
62
|
fetch-depth: 0
|
|
62
|
-
-
|
|
63
|
-
|
|
64
|
-
with:
|
|
65
|
-
python-version: "3.10"
|
|
63
|
+
- name: Install uv
|
|
64
|
+
uses: astral-sh/setup-uv@d31148d669074a8d0a63714ba94f3201e7020bc3 # v8.3.0
|
|
66
65
|
- name: Build sdist and wheel
|
|
67
|
-
run:
|
|
68
|
-
|
|
69
|
-
python -m pip install -U build
|
|
70
|
-
python -m build .
|
|
71
|
-
- uses: actions/upload-artifact@v4
|
|
66
|
+
run: uv build
|
|
67
|
+
- uses: actions/upload-artifact@v7
|
|
72
68
|
with:
|
|
73
69
|
path: dist/*
|
|
74
70
|
|
|
@@ -76,13 +72,14 @@ jobs:
|
|
|
76
72
|
needs: [tests, build]
|
|
77
73
|
runs-on: ubuntu-latest
|
|
78
74
|
if: startsWith(github.ref, 'refs/tags/')
|
|
75
|
+
environment:
|
|
76
|
+
name: pypi
|
|
77
|
+
url: https://pypi.org/p/corner
|
|
78
|
+
permissions:
|
|
79
|
+
id-token: write
|
|
79
80
|
steps:
|
|
80
|
-
- uses: actions/download-artifact@
|
|
81
|
+
- uses: actions/download-artifact@v8
|
|
81
82
|
with:
|
|
82
83
|
name: artifact
|
|
83
84
|
path: dist
|
|
84
|
-
|
|
85
|
-
- uses: pypa/gh-action-pypi-publish@v1.11.0
|
|
86
|
-
with:
|
|
87
|
-
user: __token__
|
|
88
|
-
password: ${{ secrets.pypi_password }}
|
|
85
|
+
- uses: pypa/gh-action-pypi-publish@v1.14.0
|
|
@@ -7,7 +7,7 @@ repos:
|
|
|
7
7
|
language: fail
|
|
8
8
|
files: "\\.rej$"
|
|
9
9
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
10
|
-
rev:
|
|
10
|
+
rev: v6.0.0
|
|
11
11
|
hooks:
|
|
12
12
|
- id: trailing-whitespace
|
|
13
13
|
- id: end-of-file-fixer
|
|
@@ -15,15 +15,15 @@ repos:
|
|
|
15
15
|
exclude: ".copier-answers.yml"
|
|
16
16
|
- id: check-yaml
|
|
17
17
|
- repo: https://github.com/PyCQA/isort
|
|
18
|
-
rev: "
|
|
18
|
+
rev: "9.0.0a3"
|
|
19
19
|
hooks:
|
|
20
20
|
- id: isort
|
|
21
21
|
additional_dependencies: [toml]
|
|
22
|
-
- repo: https://github.com/psf/black
|
|
23
|
-
rev: "
|
|
22
|
+
- repo: https://github.com/psf/black-pre-commit-mirror
|
|
23
|
+
rev: "26.5.1"
|
|
24
24
|
hooks:
|
|
25
25
|
- id: black-jupyter
|
|
26
26
|
- repo: https://github.com/kynan/nbstripout
|
|
27
|
-
rev: "0.
|
|
27
|
+
rev: "0.9.1"
|
|
28
28
|
hooks:
|
|
29
29
|
- id: nbstripout
|
|
@@ -38,8 +38,13 @@ TODO
|
|
|
38
38
|
## How to test the project
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
uv run pytest -v tests
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
You can also run the linters with:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
uvx pre-commit run --all-files
|
|
43
48
|
```
|
|
44
49
|
|
|
45
50
|
## How to submit changes
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: corner
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.3.0
|
|
4
4
|
Summary: Make some beautiful corner plots
|
|
5
5
|
Project-URL: Homepage, https://corner.readthedocs.io
|
|
6
6
|
Project-URL: Source, https://github.com/dfm/corner.py
|
|
7
7
|
Project-URL: Bug Tracker, https://github.com/dfm/corner.py/issues
|
|
8
8
|
Author-email: Dan Foreman-Mackey <foreman.mackey@gmail.com>
|
|
9
9
|
License: BSD 2-Clause License
|
|
10
|
+
License-File: LICENSE
|
|
10
11
|
Classifier: Development Status :: 5 - Production/Stable
|
|
11
12
|
Classifier: License :: OSI Approved :: BSD License
|
|
12
13
|
Classifier: Operating System :: OS Independent
|
|
@@ -14,8 +15,10 @@ Classifier: Programming Language :: Python :: 3
|
|
|
14
15
|
Requires-Python: >=3.9
|
|
15
16
|
Requires-Dist: matplotlib>=2.1
|
|
16
17
|
Provides-Extra: arviz
|
|
18
|
+
Requires-Dist: arviz-base; extra == 'arviz'
|
|
17
19
|
Requires-Dist: arviz>=0.9; extra == 'arviz'
|
|
18
20
|
Provides-Extra: docs
|
|
21
|
+
Requires-Dist: arviz-base; extra == 'docs'
|
|
19
22
|
Requires-Dist: arviz>=0.9; extra == 'docs'
|
|
20
23
|
Requires-Dist: ipython; extra == 'docs'
|
|
21
24
|
Requires-Dist: myst-nb; extra == 'docs'
|
|
@@ -23,6 +26,7 @@ Requires-Dist: pandoc; extra == 'docs'
|
|
|
23
26
|
Requires-Dist: sphinx-book-theme; extra == 'docs'
|
|
24
27
|
Requires-Dist: sphinx>=1.7.5; extra == 'docs'
|
|
25
28
|
Provides-Extra: test
|
|
29
|
+
Requires-Dist: arviz-base; extra == 'test'
|
|
26
30
|
Requires-Dist: arviz>=0.9; extra == 'test'
|
|
27
31
|
Requires-Dist: pytest; extra == 'test'
|
|
28
32
|
Requires-Dist: scipy; extra == 'test'
|
|
@@ -50,9 +50,7 @@ source directory, run:
|
|
|
50
50
|
|
|
51
51
|
.. code-block:: bash
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
python -m nox -s tests-PYTHON_VERSION
|
|
53
|
+
uv run pytest -v tests
|
|
55
54
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if all went as planned.
|
|
55
|
+
This might take a few minutes but you shouldn't get any errors if all went as
|
|
56
|
+
planned.
|
|
@@ -26,10 +26,18 @@
|
|
|
26
26
|
"np.random.seed(11234)\n",
|
|
27
27
|
"\n",
|
|
28
28
|
"x = np.random.randn(2, 2000)\n",
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
29
|
+
"try:\n",
|
|
30
|
+
" data = az.from_dict(\n",
|
|
31
|
+
" posterior={\"x\": x, \"y\": np.random.randn(2, 2000, 2)},\n",
|
|
32
|
+
" sample_stats={\"diverging\": x < -1.2},\n",
|
|
33
|
+
" )\n",
|
|
34
|
+
"except TypeError:\n",
|
|
35
|
+
" data = az.from_dict(\n",
|
|
36
|
+
" {\n",
|
|
37
|
+
" \"posterior\": {\"x\": x, \"y\": np.random.randn(2, 2000, 2)},\n",
|
|
38
|
+
" \"sample_stats\": {\"diverging\": x < -1.2},\n",
|
|
39
|
+
" },\n",
|
|
40
|
+
" )\n",
|
|
33
41
|
"\n",
|
|
34
42
|
"figure = corner.corner(data, divergences=True)"
|
|
35
43
|
]
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cells": [
|
|
3
|
+
{
|
|
4
|
+
"cell_type": "markdown",
|
|
5
|
+
"metadata": {},
|
|
6
|
+
"source": [
|
|
7
|
+
"# A note about sigmas\n",
|
|
8
|
+
"\n",
|
|
9
|
+
"We are regularly asked about the default \"sigma\" confidence levels in the 2D histograms. The default confidence levels are `(0.118, 0.393, 0.675, 0.864)` corresponding to the `(0.5, 1, 1.5, 2)`-sigma confidence regions for a **2D** Gaussian distribution. These differ from the corresponding `(0.382, 0.683, 0.866, 0.955)` confidence intervals you would expect for a **1D** Guassian distribution. On this page, we will give a brief explanation about Gaussian distributions, confidence levels, and how the default `corner` confidence levels work.\n",
|
|
10
|
+
"\n",
|
|
11
|
+
"In one dimension, a Gaussian probability density is given by\n",
|
|
12
|
+
"\n",
|
|
13
|
+
" pdf(r) = exp(-(r/s)^2/2) / sqrt(2*pi*s^2)\n",
|
|
14
|
+
"\n",
|
|
15
|
+
"If we integrate this distribution from `r = (-1*s, -2*s, -3*s)` to `(+1*s, +2*s, +3*s)` then we see that these ranges respectively include `(68.3%, 95.4%, 99.7%)` of the probability. Because scientists often report 1D confidence intervals and many distributions are approximately normal, it has become conventional to call reported confidence intervals \"`n-σ` confidence intervals\" if the confidence level matches the probability contained in a 1D Gaussian distribution between `r=+/-n*s`. However, the relationship between, e.g., the 68.3% confidence level and `1-σ` doesn't make sense for non-Guassian distributions because those distributions may not be parametrized by a `σ` parameter at all. As we will see below, this relationship changes even for a 2D Gaussian density.\n",
|
|
16
|
+
"\n",
|
|
17
|
+
"In two dimensions, a Gaussian probability density is given by:\n",
|
|
18
|
+
"\n",
|
|
19
|
+
" pdf(r) = exp(-(r/s)^2/2) / (2*pi*s^2)\n",
|
|
20
|
+
"\n",
|
|
21
|
+
"If we integrate (marginalize) over the polar angle and integrate the probability within a radius `r` from the center of the distribution we compute\n",
|
|
22
|
+
"\n",
|
|
23
|
+
" cdf(r) = Integral(r' * exp(-(r'/s)^2/2) / s^2, {r', 0, r})\n",
|
|
24
|
+
" = 1 - exp(-(r/s)^2/2)\n",
|
|
25
|
+
"\n",
|
|
26
|
+
"From this calculation we see that for `r = (0.5*s, 1*s, 1.5*s, 2*s)` the included probability is `(11.8%, 39.3%, 67.5%, 86.4%)` matching the `corner.py` default confidence levels for the 2D histograms.\n",
|
|
27
|
+
"\n",
|
|
28
|
+
"The advantage of using the 2D Gaussian sigma confidence levels for the 2D histograms is that, for data that are approximately multivariate normally distributed and uncorrelated, the edges of the n-sigma confidence regions shown in the 2D histogram will line up with the n-sigma confidence intervals shown in the 1D histogram at the top of the figure column. See below."
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"cell_type": "code",
|
|
33
|
+
"execution_count": null,
|
|
34
|
+
"metadata": {
|
|
35
|
+
"tags": []
|
|
36
|
+
},
|
|
37
|
+
"outputs": [],
|
|
38
|
+
"source": [
|
|
39
|
+
"import corner\n",
|
|
40
|
+
"import numpy as np\n",
|
|
41
|
+
"\n",
|
|
42
|
+
"one_sigma_1d = 0.683\n",
|
|
43
|
+
"q_lower = 1 / 2 - one_sigma_1d / 2\n",
|
|
44
|
+
"q_upper = 1 / 2 + one_sigma_1d / 2\n",
|
|
45
|
+
"\n",
|
|
46
|
+
"one_sigma_2d = 0.393\n",
|
|
47
|
+
"\n",
|
|
48
|
+
"# Generate some fake data from a Gaussian\n",
|
|
49
|
+
"np.random.seed(42)\n",
|
|
50
|
+
"x = np.random.randn(50000, 2)"
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"cell_type": "markdown",
|
|
55
|
+
"metadata": {},
|
|
56
|
+
"source": [
|
|
57
|
+
"First, plot this using the 2D Gaussian 1-sigma confidence level (39.3%) for the 2D histogram with the 1D Gaussian 1-sigma confidence interval for the 1D histogram:"
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"cell_type": "code",
|
|
62
|
+
"execution_count": null,
|
|
63
|
+
"metadata": {
|
|
64
|
+
"jupyter": {
|
|
65
|
+
"outputs_hidden": false
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"outputs": [],
|
|
69
|
+
"source": [
|
|
70
|
+
"fig = corner.corner(x, quantiles=(q_lower, q_upper), levels=(one_sigma_2d,))\n",
|
|
71
|
+
"_ = fig.suptitle(\"default 'one-sigma' level\")"
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"cell_type": "markdown",
|
|
76
|
+
"metadata": {},
|
|
77
|
+
"source": [
|
|
78
|
+
"Now, plot this using 1D Gaussian 1-sigma confidence level (68.3%) for the 2D histogram again with the 1D Gaussian 1-sigma confidence interval for the 1D histogram:"
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"cell_type": "code",
|
|
83
|
+
"execution_count": null,
|
|
84
|
+
"metadata": {
|
|
85
|
+
"jupyter": {
|
|
86
|
+
"outputs_hidden": false
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"outputs": [],
|
|
90
|
+
"source": [
|
|
91
|
+
"fig = corner.corner(x, quantiles=(q_lower, q_upper), levels=(one_sigma_1d,))\n",
|
|
92
|
+
"_ = fig.suptitle(\"alternative 'one-sigma' level\")"
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"cell_type": "markdown",
|
|
97
|
+
"metadata": {},
|
|
98
|
+
"source": [
|
|
99
|
+
"We see that the edges of the 2D confidence region no longer line up with the edges of the 1D confidence region. However, this visualization has the advantage that the same percentage of data is contained within the confidence regions in each plot, a condition which is not satisfied when using the default 2D Gaussian sigma levels."
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
"metadata": {
|
|
104
|
+
"kernelspec": {
|
|
105
|
+
"display_name": "Python 3 (ipykernel)",
|
|
106
|
+
"language": "python",
|
|
107
|
+
"name": "python3"
|
|
108
|
+
},
|
|
109
|
+
"language_info": {
|
|
110
|
+
"codemirror_mode": {
|
|
111
|
+
"name": "ipython",
|
|
112
|
+
"version": 3
|
|
113
|
+
},
|
|
114
|
+
"file_extension": ".py",
|
|
115
|
+
"mimetype": "text/x-python",
|
|
116
|
+
"name": "python",
|
|
117
|
+
"nbconvert_exporter": "python",
|
|
118
|
+
"pygments_lexer": "ipython3",
|
|
119
|
+
"version": "3.12.6"
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"nbformat": 4,
|
|
123
|
+
"nbformat_minor": 4
|
|
124
|
+
}
|
|
@@ -20,9 +20,13 @@ dependencies = ["matplotlib>=2.1"]
|
|
|
20
20
|
"Bug Tracker" = "https://github.com/dfm/corner.py/issues"
|
|
21
21
|
|
|
22
22
|
[project.optional-dependencies]
|
|
23
|
-
test = ["pytest", "arviz>=0.9", "scipy"]
|
|
24
|
-
arviz = ["arviz>=0.9"]
|
|
25
|
-
docs = ["arviz>=0.9", "sphinx>=1.7.5", "pandoc", "myst-nb", "sphinx-book-theme", "ipython"]
|
|
23
|
+
test = ["pytest", "arviz>=0.9", "arviz-base", "scipy"]
|
|
24
|
+
arviz = ["arviz>=0.9", "arviz-base"]
|
|
25
|
+
docs = ["arviz>=0.9", "arviz-base", "sphinx>=1.7.5", "pandoc", "myst-nb", "sphinx-book-theme", "ipython"]
|
|
26
|
+
|
|
27
|
+
# Installed by default with `uv run`/`uv sync`, so `uv run pytest` just works.
|
|
28
|
+
[dependency-groups]
|
|
29
|
+
dev = ["pytest", "arviz>=0.9", "arviz-base", "scipy"]
|
|
26
30
|
|
|
27
31
|
[build-system]
|
|
28
32
|
requires = ["hatchling", "hatch-vcs"]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
__all__ = [
|
|
4
|
+
"corner",
|
|
5
|
+
"hist2d",
|
|
6
|
+
"quantile",
|
|
7
|
+
"overplot_lines",
|
|
8
|
+
"overplot_points",
|
|
9
|
+
"axis_from_param_indices",
|
|
10
|
+
"param_indices_from_axis",
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
from corner.core import (
|
|
14
|
+
axis_from_param_indices,
|
|
15
|
+
hist2d,
|
|
16
|
+
overplot_lines,
|
|
17
|
+
overplot_points,
|
|
18
|
+
param_indices_from_axis,
|
|
19
|
+
quantile,
|
|
20
|
+
)
|
|
21
|
+
from corner.corner import corner
|
|
22
|
+
from corner.version import version as __version__
|
|
@@ -3,14 +3,48 @@
|
|
|
3
3
|
__all__ = ["arviz_corner"]
|
|
4
4
|
|
|
5
5
|
import logging
|
|
6
|
+
import re
|
|
6
7
|
from collections.abc import Mapping
|
|
7
8
|
|
|
8
9
|
import numpy as np
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
try:
|
|
12
|
+
from arviz.preview import convert_to_dataset
|
|
13
|
+
except ImportError:
|
|
14
|
+
from arviz import convert_to_dataset
|
|
11
15
|
|
|
12
16
|
# Support multiple versions of arviz
|
|
13
17
|
try:
|
|
18
|
+
# arviz < 1.0
|
|
19
|
+
from arviz.utils import _var_names, get_coords
|
|
20
|
+
except ImportError:
|
|
21
|
+
# arviz >= 1.0: these functions were removed
|
|
22
|
+
|
|
23
|
+
def _var_names(var_names, dataset, filter_vars=None):
|
|
24
|
+
if var_names is None:
|
|
25
|
+
return None
|
|
26
|
+
if filter_vars == "like":
|
|
27
|
+
return [
|
|
28
|
+
v
|
|
29
|
+
for v in dataset.data_vars
|
|
30
|
+
if any(vn in v for vn in var_names)
|
|
31
|
+
]
|
|
32
|
+
elif filter_vars == "regex":
|
|
33
|
+
return [
|
|
34
|
+
v
|
|
35
|
+
for v in dataset.data_vars
|
|
36
|
+
if any(re.search(vn, v) for vn in var_names)
|
|
37
|
+
]
|
|
38
|
+
return list(var_names)
|
|
39
|
+
|
|
40
|
+
def get_coords(dataset, coords):
|
|
41
|
+
if not coords:
|
|
42
|
+
return dataset
|
|
43
|
+
return dataset.sel(coords)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
try:
|
|
47
|
+
# Very old arviz
|
|
14
48
|
from arviz.plots.plot_utils import (
|
|
15
49
|
make_label,
|
|
16
50
|
xarray_to_ndarray,
|
|
@@ -24,8 +58,14 @@ try:
|
|
|
24
58
|
]
|
|
25
59
|
|
|
26
60
|
except ImportError:
|
|
27
|
-
|
|
28
|
-
|
|
61
|
+
try:
|
|
62
|
+
# Medium arviz (< 1.0)
|
|
63
|
+
from arviz.labels import BaseLabeller
|
|
64
|
+
from arviz.sel_utils import xarray_to_ndarray, xarray_var_iter
|
|
65
|
+
except ImportError:
|
|
66
|
+
# arviz >= 1.0
|
|
67
|
+
from arviz import xarray_to_ndarray, xarray_var_iter
|
|
68
|
+
from arviz_base.labels import BaseLabeller
|
|
29
69
|
|
|
30
70
|
def _get_labels(plotters, labeller=None):
|
|
31
71
|
if labeller is None:
|
|
@@ -112,6 +112,14 @@ def corner_impl(
|
|
|
112
112
|
plotdim = factor * K + factor * (K - 1.0) * whspace
|
|
113
113
|
dim = lbdim + plotdim + trdim
|
|
114
114
|
|
|
115
|
+
# Make title_fmt into a list if necessary, otherwise check length
|
|
116
|
+
if isinstance(title_fmt, str):
|
|
117
|
+
title_fmt = [title_fmt] * K
|
|
118
|
+
elif title_fmt is not None:
|
|
119
|
+
assert (
|
|
120
|
+
len(title_fmt) == K
|
|
121
|
+
), "'title_fmt' should contain as many elements as data dimensions"
|
|
122
|
+
|
|
115
123
|
# Make axes_scale into a list if necessary, otherwise check length
|
|
116
124
|
if isinstance(axes_scale, str):
|
|
117
125
|
axes_scale = [axes_scale] * K
|
|
@@ -263,7 +271,7 @@ def corner_impl(
|
|
|
263
271
|
q_m, q_p = q_mid - q_lo, q_hi - q_mid
|
|
264
272
|
|
|
265
273
|
# Format the quantile display.
|
|
266
|
-
fmt = "{{0:{0}}}".format(title_fmt).format
|
|
274
|
+
fmt = "{{0:{0}}}".format(title_fmt[i]).format
|
|
267
275
|
title = r"${{{0}}}_{{-{1}}}^{{+{2}}}$"
|
|
268
276
|
title = title.format(fmt(q_mid), fmt(q_m), fmt(q_p))
|
|
269
277
|
|
|
@@ -562,9 +570,10 @@ def hist2d(
|
|
|
562
570
|
If true, suppress warnings for small datasets.
|
|
563
571
|
|
|
564
572
|
levels : array_like
|
|
565
|
-
|
|
566
|
-
If None, (0.
|
|
567
|
-
|
|
573
|
+
Confidence levels to use to draw contours.
|
|
574
|
+
If None, confidence levels (0.118, 0.393, 0.675, and 0.864) will be drawn.
|
|
575
|
+
For a 2D Gaussian distribution, these correspond to contours separated from the
|
|
576
|
+
center of the distribution by (0.5, 1, 1.5, 2)-sigma.
|
|
568
577
|
See https://corner.readthedocs.io/en/latest/pages/sigmas/
|
|
569
578
|
|
|
570
579
|
ax : matplotlib.Axes
|
|
@@ -891,6 +900,84 @@ def overplot_points(fig, xs, reverse=False, **kwargs):
|
|
|
891
900
|
axes[k2, k1].plot(xs[k1], xs[k2], **kwargs)
|
|
892
901
|
|
|
893
902
|
|
|
903
|
+
def axis_from_param_indices(fig, ix, iy, return_axis=True):
|
|
904
|
+
"""
|
|
905
|
+
Get axis corresponding to indices ``ix``, ``iy`` of the input data. This can be used, e.g., for
|
|
906
|
+
manually adding additional data or labels to a specific axis. This is the inverse of
|
|
907
|
+
`param_indices_from_axis`.
|
|
908
|
+
|
|
909
|
+
Parameters
|
|
910
|
+
----------
|
|
911
|
+
fig : Figure
|
|
912
|
+
The figure generated by a call to :func:`corner.corner`.
|
|
913
|
+
|
|
914
|
+
ix, iy : int
|
|
915
|
+
Indices of the parameter list corresponding to the plotted ``x`` and ``y`` axes. Only cases
|
|
916
|
+
where ``ix <= iy`` have plotted axes, and ``ix == iy`` corresponds to the histogram axis for
|
|
917
|
+
parameter index ``ix``. The function doesn't raise an error when ``ix > iy`` corresponding to one
|
|
918
|
+
of the hidden axes, though it does raise an error if either ``ix`` or ``iy`` is too large for the
|
|
919
|
+
dimensions of the plotted ``fig``.
|
|
920
|
+
|
|
921
|
+
return_axis : bool
|
|
922
|
+
Return either the axis itself or its integer index
|
|
923
|
+
|
|
924
|
+
Returns
|
|
925
|
+
-------
|
|
926
|
+
ax : axis
|
|
927
|
+
Entry in the ``fig.axes`` list.
|
|
928
|
+
"""
|
|
929
|
+
ndim = int(np.sqrt(len(fig.axes)))
|
|
930
|
+
if ix > ndim - 1:
|
|
931
|
+
msg = f"ix={ix} too large for ndim={ndim}"
|
|
932
|
+
raise ValueError(msg)
|
|
933
|
+
elif iy > ndim - 1:
|
|
934
|
+
msg = f"ix={ix} too large for ndim={ndim}"
|
|
935
|
+
raise ValueError(msg)
|
|
936
|
+
|
|
937
|
+
for i in range(ndim**2):
|
|
938
|
+
ix_i = range(ndim)[(i % ndim)]
|
|
939
|
+
iy_i = range(ndim)[(i // ndim) - ndim]
|
|
940
|
+
|
|
941
|
+
if (ix == ix_i) & (iy == iy_i):
|
|
942
|
+
break
|
|
943
|
+
|
|
944
|
+
if return_axis:
|
|
945
|
+
return fig.axes[i]
|
|
946
|
+
else:
|
|
947
|
+
return i
|
|
948
|
+
|
|
949
|
+
|
|
950
|
+
def param_indices_from_axis(fig, i):
|
|
951
|
+
"""
|
|
952
|
+
Get indices ``ix``, ``iy`` of the input data associated with one of the plotted axes. This is the
|
|
953
|
+
inverse of `axis_from_param_indices`.
|
|
954
|
+
|
|
955
|
+
Parameters
|
|
956
|
+
----------
|
|
957
|
+
fig : Figure
|
|
958
|
+
The figure generated by a call to :func:`corner.corner`.
|
|
959
|
+
|
|
960
|
+
i : int
|
|
961
|
+
Index of an entry in the ``fig.axes`` list
|
|
962
|
+
|
|
963
|
+
Returns
|
|
964
|
+
-------
|
|
965
|
+
ix, iy : int
|
|
966
|
+
Indices of the figure axes list corresponding to the plotted ``x`` and ``y`` of the specified axis
|
|
967
|
+
index
|
|
968
|
+
"""
|
|
969
|
+
if i > len(fig.axes):
|
|
970
|
+
msg = f"{i} must be < len(fig.axes) = {len(fig.axes)}"
|
|
971
|
+
raise ValueError(msg)
|
|
972
|
+
|
|
973
|
+
ndim = int(np.sqrt(len(fig.axes)))
|
|
974
|
+
|
|
975
|
+
ix = range(ndim)[(i % ndim)]
|
|
976
|
+
iy = range(ndim)[(i // ndim) - ndim]
|
|
977
|
+
|
|
978
|
+
return ix, iy
|
|
979
|
+
|
|
980
|
+
|
|
894
981
|
def _parse_input(xs):
|
|
895
982
|
xs = np.atleast_1d(xs)
|
|
896
983
|
if len(xs.shape) == 1:
|
|
@@ -63,7 +63,7 @@ def corner(
|
|
|
63
63
|
Parameters
|
|
64
64
|
----------
|
|
65
65
|
data : obj
|
|
66
|
-
Any object that can be converted to an ``arviz.InferenceData`` object.
|
|
66
|
+
Any object that can be converted to an ``arviz.InferenceData`` or ``xarrayDataTree`` object.
|
|
67
67
|
Refer to documentation of ``arviz.convert_to_dataset`` for details.
|
|
68
68
|
|
|
69
69
|
bins : int or array_like[ndim,]
|
|
@@ -148,10 +148,10 @@ def corner(
|
|
|
148
148
|
errors. If `None` (default), inherit the values from quantiles, unless
|
|
149
149
|
quantiles is `None`, in which case it defaults to [0.16,0.5,0.84]
|
|
150
150
|
|
|
151
|
-
title_fmt : string
|
|
152
|
-
The format string for the quantiles given in titles
|
|
153
|
-
set ``show_titles=True`` and ``title_fmt=None``,
|
|
154
|
-
shown as the titles. (default: ``.2f``)
|
|
151
|
+
title_fmt : string or iterable (ndim,)
|
|
152
|
+
The format string for the quantiles given in titles for eachimension.
|
|
153
|
+
If you explicitly set ``show_titles=True`` and ``title_fmt=None``,
|
|
154
|
+
the labels will be shown as the titles. (default: ``.2f``)
|
|
155
155
|
|
|
156
156
|
title_kwargs : dict
|
|
157
157
|
Any extra keyword arguments to send to the `set_title` command.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# file generated by vcs-versioning
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
__all__ = [
|
|
6
|
+
"__version__",
|
|
7
|
+
"__version_tuple__",
|
|
8
|
+
"version",
|
|
9
|
+
"version_tuple",
|
|
10
|
+
"__commit_id__",
|
|
11
|
+
"commit_id",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
version: str
|
|
15
|
+
__version__: str
|
|
16
|
+
__version_tuple__: tuple[int | str, ...]
|
|
17
|
+
version_tuple: tuple[int | str, ...]
|
|
18
|
+
commit_id: str | None
|
|
19
|
+
__commit_id__: str | None
|
|
20
|
+
|
|
21
|
+
__version__ = version = '2.3.0'
|
|
22
|
+
__version_tuple__ = version_tuple = (2, 3, 0)
|
|
23
|
+
|
|
24
|
+
__commit_id__ = commit_id = None
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|