mc3 3.2.1__tar.gz → 3.3.1__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.
- mc3-3.3.1/.github/workflows/python-package.yml +47 -0
- mc3-3.3.1/MANIFEST.in +12 -0
- {mc3-3.2.1 → mc3-3.3.1}/PKG-INFO +7 -25
- mc3-3.3.1/docs/docs_requirements.txt +6 -0
- {mc3-3.2.1 → mc3-3.3.1}/docs/get_started.rst +1 -1
- {mc3-3.2.1 → mc3-3.3.1}/docs/index.rst +1 -1
- {mc3-3.2.1 → mc3-3.3.1}/mc3/__init__.py +1 -1
- {mc3-3.2.1 → mc3-3.3.1}/mc3/__main__.py +1 -1
- {mc3-3.2.1 → mc3-3.3.1}/mc3/chain.py +1 -1
- {mc3-3.2.1 → mc3-3.3.1}/mc3/fit_driver.py +1 -1
- {mc3-3.2.1 → mc3-3.3.1}/mc3/mcmc_driver.py +1 -1
- {mc3-3.2.1 → mc3-3.3.1}/mc3/plots/__init__.py +1 -1
- {mc3-3.2.1 → mc3-3.3.1}/mc3/plots/colors.py +1 -1
- {mc3-3.2.1 → mc3-3.3.1}/mc3/plots/plot_functions.py +1 -1
- {mc3-3.2.1 → mc3-3.3.1}/mc3/plots/posterior.py +90 -34
- {mc3-3.2.1 → mc3-3.3.1}/mc3/sampler_driver.py +1 -1
- {mc3-3.2.1 → mc3-3.3.1}/mc3/stats/__init__.py +3 -1
- mc3-3.3.1/mc3/stats/dwt.py +229 -0
- {mc3-3.2.1 → mc3-3.3.1}/mc3/stats/gelman.py +1 -1
- {mc3-3.2.1 → mc3-3.3.1}/mc3/stats/prayer.py +1 -1
- {mc3-3.2.1 → mc3-3.3.1}/mc3/stats/stats.py +78 -147
- mc3-3.3.1/mc3/stats/time_averaging.py +199 -0
- {mc3-3.2.1 → mc3-3.3.1}/mc3/utils/__init__.py +1 -1
- {mc3-3.2.1 → mc3-3.3.1}/mc3/utils/log.py +1 -1
- {mc3-3.2.1 → mc3-3.3.1}/mc3/utils/utils.py +1 -1
- {mc3-3.2.1 → mc3-3.3.1}/mc3/version.py +2 -2
- {mc3-3.2.1 → mc3-3.3.1}/mc3.egg-info/PKG-INFO +7 -25
- {mc3-3.2.1 → mc3-3.3.1}/mc3.egg-info/SOURCES.txt +3 -15
- {mc3-3.2.1 → mc3-3.3.1}/mc3.egg-info/requires.txt +2 -2
- {mc3-3.2.1 → mc3-3.3.1}/pyproject.toml +5 -5
- mc3-3.3.1/requirements.txt +4 -0
- {mc3-3.2.1 → mc3-3.3.1}/tests/test_fit.py +1 -1
- {mc3-3.2.1 → mc3-3.3.1}/tests/test_logging.py +1 -1
- {mc3-3.2.1 → mc3-3.3.1}/tests/test_mcmc.py +1 -1
- {mc3-3.2.1 → mc3-3.3.1}/tests/test_plots.py +1 -1
- {mc3-3.2.1 → mc3-3.3.1}/tests/test_stats.py +39 -34
- {mc3-3.2.1 → mc3-3.3.1}/tests/test_utils.py +1 -1
- mc3-3.2.1/MANIFEST.in +0 -19
- mc3-3.2.1/Makefile +0 -46
- mc3-3.2.1/docs/figures/quad_bestfit.png +0 -0
- mc3-3.2.1/docs/figures/quad_fitting.png +0 -0
- mc3-3.2.1/docs/figures/quad_hist.png +0 -0
- mc3-3.2.1/docs/figures/quad_pairwise.png +0 -0
- mc3-3.2.1/docs/figures/quad_trace.png +0 -0
- mc3-3.2.1/docs/figures/rms-vs-binsize.png +0 -0
- mc3-3.2.1/mc3/stats/time_averaging.py +0 -60
- mc3-3.2.1/requirements.txt +0 -4
- mc3-3.2.1/setup.py +0 -38
- mc3-3.2.1/src_c/_binarray.c +0 -107
- mc3-3.2.1/src_c/_chisq.c +0 -167
- mc3-3.2.1/src_c/_dwt.c +0 -216
- mc3-3.2.1/src_c/_time_averaging.c +0 -171
- mc3-3.2.1/src_c/include/ind.h +0 -9
- mc3-3.2.1/src_c/include/stats.h +0 -224
- mc3-3.2.1/src_c/include/wavelet.h +0 -128
- {mc3-3.2.1 → mc3-3.3.1}/.readthedocs.yml +0 -0
- {mc3-3.2.1 → mc3-3.3.1}/CONTRIBUTING.md +0 -0
- {mc3-3.2.1 → mc3-3.3.1}/LICENSE +0 -0
- {mc3-3.2.1 → mc3-3.3.1}/README.md +0 -0
- {mc3-3.2.1 → mc3-3.3.1}/docs/Makefile +0 -0
- {mc3-3.2.1 → mc3-3.3.1}/docs/api.rst +0 -0
- {mc3-3.2.1 → mc3-3.3.1}/docs/conf.py +0 -0
- {mc3-3.2.1 → mc3-3.3.1}/docs/contributing.rst +0 -0
- {mc3-3.2.1 → mc3-3.3.1}/docs/fit_tutorial.rst +0 -0
- {mc3-3.2.1 → mc3-3.3.1}/docs/license.rst +0 -0
- {mc3-3.2.1 → mc3-3.3.1}/docs/make.bat +0 -0
- {mc3-3.2.1 → mc3-3.3.1}/docs/mcmc_tutorial.rst +0 -0
- {mc3-3.2.1 → mc3-3.3.1}/docs/references.rst +0 -0
- {mc3-3.2.1 → mc3-3.3.1}/docs/time_averaging.rst +0 -0
- {mc3-3.2.1 → mc3-3.3.1}/examples/get_started.py +0 -0
- {mc3-3.2.1 → mc3-3.3.1}/examples/timeavg.py +0 -0
- {mc3-3.2.1 → mc3-3.3.1}/examples/tutorial.py +0 -0
- {mc3-3.2.1 → mc3-3.3.1}/mc3.egg-info/dependency_links.txt +0 -0
- {mc3-3.2.1 → mc3-3.3.1}/mc3.egg-info/entry_points.txt +0 -0
- {mc3-3.2.1 → mc3-3.3.1}/mc3.egg-info/top_level.txt +0 -0
- {mc3-3.2.1 → mc3-3.3.1}/pytest.ini +0 -0
- {mc3-3.2.1 → mc3-3.3.1}/setup.cfg +0 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
|
|
2
|
+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
|
|
3
|
+
|
|
4
|
+
name: Tests
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [ "*" ]
|
|
9
|
+
pull_request:
|
|
10
|
+
branches: [ "main" ]
|
|
11
|
+
schedule:
|
|
12
|
+
- cron: '0 12 1 * *'
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
build:
|
|
16
|
+
|
|
17
|
+
runs-on: ${{ matrix.os }}
|
|
18
|
+
strategy:
|
|
19
|
+
fail-fast: false
|
|
20
|
+
matrix:
|
|
21
|
+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
22
|
+
os: [ubuntu-latest]
|
|
23
|
+
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v6
|
|
26
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
27
|
+
uses: actions/setup-python@v6
|
|
28
|
+
with:
|
|
29
|
+
python-version: ${{ matrix.python-version }}
|
|
30
|
+
- name: Install dependencies
|
|
31
|
+
run: |
|
|
32
|
+
python -m pip install --upgrade pip
|
|
33
|
+
python -m pip install flake8 pytest
|
|
34
|
+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
|
35
|
+
|
|
36
|
+
- name: Install package
|
|
37
|
+
run: |
|
|
38
|
+
python -m pip install -e .
|
|
39
|
+
- name: Lint with flake8
|
|
40
|
+
run: |
|
|
41
|
+
# stop the build if there are Python syntax errors or undefined names
|
|
42
|
+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
|
43
|
+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
|
44
|
+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
|
45
|
+
- name: Test with pytest
|
|
46
|
+
run: |
|
|
47
|
+
pytest tests -v
|
mc3-3.3.1/MANIFEST.in
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
include MANIFEST.in
|
|
2
|
+
include CONTRIBUTING.md
|
|
3
|
+
include README.md
|
|
4
|
+
include LICENSE
|
|
5
|
+
include pyproject.toml
|
|
6
|
+
include requirements.txt
|
|
7
|
+
include pytest.ini
|
|
8
|
+
include .readthedocs.yml
|
|
9
|
+
include .github/workflows/python-package.yml
|
|
10
|
+
include tests/*
|
|
11
|
+
include docs/*
|
|
12
|
+
include examples/*.py
|
{mc3-3.2.1 → mc3-3.3.1}/PKG-INFO
RENAMED
|
@@ -1,37 +1,19 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: mc3
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.3.1
|
|
4
4
|
Summary: Multi-core Markov-chain Monte Carlo package
|
|
5
5
|
Author-email: Patricio Cubillos <patricio.cubillos@oeaw.ac.at>
|
|
6
|
-
License:
|
|
7
|
-
|
|
8
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
10
|
-
in the Software without restriction, including without limitation the rights
|
|
11
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
13
|
-
furnished to do so, subject to the following conditions:
|
|
14
|
-
|
|
15
|
-
The above copyright notice and this permission notice shall be included in
|
|
16
|
-
all copies or substantial portions of the Software.
|
|
17
|
-
|
|
18
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
24
|
-
THE SOFTWARE.
|
|
25
|
-
|
|
6
|
+
License-Expression: MIT
|
|
26
7
|
Project-URL: Homepage, https://github.com/pcubillos/mc3
|
|
27
|
-
Requires-Python: >=3.
|
|
8
|
+
Requires-Python: >=3.10
|
|
28
9
|
Description-Content-Type: text/markdown
|
|
29
10
|
License-File: LICENSE
|
|
30
|
-
Requires-Dist: numpy>=
|
|
11
|
+
Requires-Dist: numpy>=2.0.0
|
|
31
12
|
Requires-Dist: scipy>=1.5.4
|
|
32
|
-
Requires-Dist: matplotlib>=3.
|
|
13
|
+
Requires-Dist: matplotlib>=3.8.0
|
|
33
14
|
Provides-Extra: test
|
|
34
15
|
Requires-Dist: pytest>=6.0; extra == "test"
|
|
16
|
+
Dynamic: license-file
|
|
35
17
|
|
|
36
18
|
# mc3: Multi-core Markov-chain Monte Carlo
|
|
37
19
|
> A Python implementation of the Markov-chain Monte Carlo algorithm.
|
|
@@ -6,7 +6,7 @@ Getting Started
|
|
|
6
6
|
System Requirements
|
|
7
7
|
-------------------
|
|
8
8
|
|
|
9
|
-
``mc3`` is compatible with Python 3.
|
|
9
|
+
``mc3`` is compatible with Python 3.10+, and is `tested
|
|
10
10
|
<https://github.com/pcubillos/mc3/actions/workflows/python-package.yml>`_ to work on Unix/Linux and OS X machines.
|
|
11
11
|
|
|
12
12
|
Install
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2015-
|
|
1
|
+
# Copyright (c) 2015-2026 Patricio Cubillos and contributors.
|
|
2
2
|
# mc3 is open-source software under the MIT license (see LICENSE).
|
|
3
3
|
|
|
4
4
|
__all__ = [
|
|
@@ -114,9 +114,9 @@ def hist_2D(posterior, ranges, nbins):
|
|
|
114
114
|
def _histogram(
|
|
115
115
|
posterior, estimates, ranges, axes,
|
|
116
116
|
nbins, pdf, xpdf, hpd_min, low_bounds, high_bounds,
|
|
117
|
-
linewidth, theme, orientation,
|
|
118
|
-
|
|
119
|
-
clear=True,
|
|
117
|
+
linewidth, theme, orientation,
|
|
118
|
+
normalization='density',
|
|
119
|
+
alpha=0.6, top_pad=1.05, clear=True,
|
|
120
120
|
):
|
|
121
121
|
"""
|
|
122
122
|
Lowest-lever routine to plot marginal posterior distributions.
|
|
@@ -128,18 +128,17 @@ def _histogram(
|
|
|
128
128
|
)
|
|
129
129
|
|
|
130
130
|
hist_kw = {
|
|
131
|
-
'bins': nbins,
|
|
132
131
|
'linewidth': linewidth,
|
|
133
132
|
'orientation': orientation,
|
|
134
133
|
'facecolor': to_rgba(theme.light_color, alpha=alpha),
|
|
135
134
|
'edgecolor': theme.color,
|
|
136
|
-
'histtype': 'stepfilled',
|
|
137
|
-
'density': True,
|
|
138
135
|
}
|
|
139
136
|
if has_credible_interval:
|
|
140
137
|
hist_kw['facecolor'] = 'none'
|
|
141
138
|
|
|
142
139
|
for i in range(npars):
|
|
140
|
+
if np.any(np.isnan(posterior[:,i])):
|
|
141
|
+
continue
|
|
143
142
|
ax = axes[i]
|
|
144
143
|
if clear:
|
|
145
144
|
ax.clear()
|
|
@@ -152,7 +151,13 @@ def _histogram(
|
|
|
152
151
|
fill_between = ax.fill_betweenx
|
|
153
152
|
axline = ax.axhline
|
|
154
153
|
|
|
155
|
-
vals, bins
|
|
154
|
+
vals, bins = np.histogram(
|
|
155
|
+
posterior[:,i], bins=nbins, density=True, range=ranges[i],
|
|
156
|
+
)
|
|
157
|
+
if normalization == 'top':
|
|
158
|
+
vals /= np.amax(vals)
|
|
159
|
+
ax.stairs(vals, bins, fill=True, **hist_kw)
|
|
160
|
+
|
|
156
161
|
# Plot the credible intervals as shaded areas:
|
|
157
162
|
if has_credible_interval:
|
|
158
163
|
vals = np.r_[0, vals, 0]
|
|
@@ -533,6 +538,8 @@ class Marginal():
|
|
|
533
538
|
bins=25, fontsize=11, linewidth=1.5,
|
|
534
539
|
axes=None,
|
|
535
540
|
show_texts=True, show_estimates=True,
|
|
541
|
+
normalization=None,
|
|
542
|
+
alpha=0.6,
|
|
536
543
|
):
|
|
537
544
|
self.source = source
|
|
538
545
|
self.fig = None
|
|
@@ -543,7 +550,11 @@ class Marginal():
|
|
|
543
550
|
self.pnames = pnames
|
|
544
551
|
self.bestp = bestp
|
|
545
552
|
self.ranges = ranges
|
|
553
|
+
if normalization is None:
|
|
554
|
+
normalization = 'density'
|
|
555
|
+
self.normalization = normalization
|
|
546
556
|
self.theme = theme
|
|
557
|
+
self.alpha = alpha
|
|
547
558
|
|
|
548
559
|
if nx is None or ny is None:
|
|
549
560
|
# Default layout:
|
|
@@ -629,7 +640,8 @@ class Marginal():
|
|
|
629
640
|
self.source.pdf, self.source.xpdf,
|
|
630
641
|
hpd_min, self.source.low_bounds, self.source.high_bounds,
|
|
631
642
|
self.linewidth, self.theme,
|
|
632
|
-
self.orientation,
|
|
643
|
+
self.orientation, self.normalization,
|
|
644
|
+
alpha=self.alpha,
|
|
633
645
|
top_pad=1.25,
|
|
634
646
|
)
|
|
635
647
|
_plot_marginal(self)
|
|
@@ -637,7 +649,7 @@ class Marginal():
|
|
|
637
649
|
if savefile is not None:
|
|
638
650
|
self.fig.savefig(savefile, dpi=300)
|
|
639
651
|
|
|
640
|
-
def overplot(self,
|
|
652
|
+
def overplot(self, posts, labels=None, nlevels=4, alpha=0.4, axes_mask=None):
|
|
641
653
|
"""
|
|
642
654
|
Overplot additional posteriors in the same figure.
|
|
643
655
|
|
|
@@ -650,7 +662,7 @@ class Marginal():
|
|
|
650
662
|
|
|
651
663
|
Parameters
|
|
652
664
|
----------
|
|
653
|
-
posts: 1D iterable of Posterior objects
|
|
665
|
+
posts: Posterior or 1D iterable of Posterior objects
|
|
654
666
|
Currently there are no checks that these new posteriors
|
|
655
667
|
have the same parameters (nor same statistics) as self.
|
|
656
668
|
The user needs to make sure they are all compartible.
|
|
@@ -659,25 +671,41 @@ class Marginal():
|
|
|
659
671
|
length of labels has to be one more than posts, because
|
|
660
672
|
it also contains the label for self.
|
|
661
673
|
"""
|
|
662
|
-
if
|
|
663
|
-
|
|
664
|
-
|
|
674
|
+
if isinstance(posts, Posterior):
|
|
675
|
+
posts = [posts]
|
|
676
|
+
all_posts = [self.source] + list(posts)
|
|
677
|
+
for i,post in enumerate(posts):
|
|
678
|
+
estimates = post.estimates
|
|
679
|
+
if not self.show_estimates:
|
|
680
|
+
estimates = [None for _ in estimates]
|
|
665
681
|
hpd_min = None
|
|
682
|
+
if '_like' in self.statistics:
|
|
683
|
+
hpd_min = self.source.hpd_min
|
|
666
684
|
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
685
|
+
_histogram(
|
|
686
|
+
post.posterior, estimates, self.ranges,
|
|
687
|
+
self.hist_axes, self.bins,
|
|
688
|
+
post.pdf, post.xpdf,
|
|
689
|
+
hpd_min, post.low_bounds, post.high_bounds,
|
|
690
|
+
self.linewidth, post.theme,
|
|
691
|
+
post.orientation, self.normalization, alpha=alpha,
|
|
692
|
+
clear=False,
|
|
693
|
+
)
|
|
694
|
+
if not self.show_texts:
|
|
695
|
+
return
|
|
696
|
+
text_cols = [post.theme.color for post in all_posts]
|
|
697
|
+
for text in self.stats_texts:
|
|
698
|
+
text.set_visible(False)
|
|
699
|
+
self.stats_texts = []
|
|
670
700
|
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
self.
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
clear=False,
|
|
680
|
-
)
|
|
701
|
+
for j in range(self.npars):
|
|
702
|
+
stats_texts = [
|
|
703
|
+
'' if post.mask[j] else rf'{post.tex_estimates[j]}'
|
|
704
|
+
for post in all_posts
|
|
705
|
+
]
|
|
706
|
+
self.stats_texts += colors.rainbow_text(
|
|
707
|
+
self.hist_axes[j], stats_texts, self.fontsize, text_cols,
|
|
708
|
+
)
|
|
681
709
|
|
|
682
710
|
|
|
683
711
|
class Figure(Marginal):
|
|
@@ -694,10 +722,12 @@ class Figure(Marginal):
|
|
|
694
722
|
bins=25, nlevels=6, fontsize=None, linewidth=None,
|
|
695
723
|
show_texts=True, show_estimates=True,
|
|
696
724
|
show_colorbar=True,
|
|
725
|
+
normalization=None,
|
|
726
|
+
figure=None,
|
|
697
727
|
fignum=None,
|
|
698
728
|
):
|
|
699
729
|
self.source = source
|
|
700
|
-
self.fig =
|
|
730
|
+
self.fig = figure
|
|
701
731
|
self.pair_axes = None
|
|
702
732
|
self.hist_axes = None
|
|
703
733
|
self.posterior = posterior
|
|
@@ -743,6 +773,9 @@ class Figure(Marginal):
|
|
|
743
773
|
self.fontsize = fontsize
|
|
744
774
|
self.linewidth = linewidth
|
|
745
775
|
self.orientation = 'vertical'
|
|
776
|
+
if normalization is None:
|
|
777
|
+
normalization = 'density'
|
|
778
|
+
self.normalization = normalization
|
|
746
779
|
self.show_texts = show_texts
|
|
747
780
|
self.show_estimates = show_estimates
|
|
748
781
|
self.show_colorbar = show_colorbar
|
|
@@ -849,7 +882,7 @@ class Figure(Marginal):
|
|
|
849
882
|
hpd_min,
|
|
850
883
|
self.source.low_bounds, self.source.high_bounds,
|
|
851
884
|
self.linewidth, self.theme,
|
|
852
|
-
self.orientation,
|
|
885
|
+
self.orientation, self.normalization,
|
|
853
886
|
)
|
|
854
887
|
_plot_pairwise(self)
|
|
855
888
|
|
|
@@ -869,7 +902,7 @@ class Figure(Marginal):
|
|
|
869
902
|
|
|
870
903
|
Parameters
|
|
871
904
|
----------
|
|
872
|
-
posts: 1D iterable of Posterior objects
|
|
905
|
+
posts: Posterior or 1D iterable of Posterior objects
|
|
873
906
|
Currently there are no checks that these new posteriors
|
|
874
907
|
have the same parameters (nor same statistics) as self.
|
|
875
908
|
The user needs to make sure they are all compartible.
|
|
@@ -878,6 +911,8 @@ class Figure(Marginal):
|
|
|
878
911
|
length of labels has to be one more than posts, because
|
|
879
912
|
it also contains the label for self.
|
|
880
913
|
"""
|
|
914
|
+
if isinstance(posts, Posterior):
|
|
915
|
+
posts = [posts]
|
|
881
916
|
all_posts = [self.source] + list(posts)
|
|
882
917
|
for post in posts:
|
|
883
918
|
post.hist_xran, post.hist, post.lmax = hist_2D(
|
|
@@ -934,7 +969,9 @@ class Figure(Marginal):
|
|
|
934
969
|
post.posterior, estimates, self.ranges, self.hist_axes,
|
|
935
970
|
self.bins, post.pdf, post.xpdf,
|
|
936
971
|
hpd_min, post.low_bounds, post.high_bounds,
|
|
937
|
-
self.linewidth, post.theme, post.orientation,
|
|
972
|
+
self.linewidth, post.theme, post.orientation,
|
|
973
|
+
normalization=self.normalization,
|
|
974
|
+
alpha=alpha,
|
|
938
975
|
clear=False,
|
|
939
976
|
)
|
|
940
977
|
if not self.show_texts:
|
|
@@ -1044,7 +1081,7 @@ class StatisticsUpdate(ShareUpdate):
|
|
|
1044
1081
|
)
|
|
1045
1082
|
|
|
1046
1083
|
|
|
1047
|
-
class Posterior(
|
|
1084
|
+
class Posterior():
|
|
1048
1085
|
"""
|
|
1049
1086
|
Classification of posterior plotting tools.
|
|
1050
1087
|
|
|
@@ -1089,7 +1126,9 @@ class Posterior(object):
|
|
|
1089
1126
|
theme='blue', orientation='vertical',
|
|
1090
1127
|
show_texts=True, show_estimates=True,
|
|
1091
1128
|
show_colorbar=True,
|
|
1129
|
+
normalization='density',
|
|
1092
1130
|
seed=314159,
|
|
1131
|
+
mask=None,
|
|
1093
1132
|
):
|
|
1094
1133
|
self.figures = []
|
|
1095
1134
|
nsamples, self.npars = np.shape(posterior)
|
|
@@ -1110,6 +1149,7 @@ class Posterior(object):
|
|
|
1110
1149
|
self.ranges = ranges
|
|
1111
1150
|
self.theme = theme
|
|
1112
1151
|
self.orientation = orientation
|
|
1152
|
+
self.normalization = normalization
|
|
1113
1153
|
self.show_texts = show_texts
|
|
1114
1154
|
self.show_estimates = show_estimates
|
|
1115
1155
|
self.show_colorbar = show_colorbar
|
|
@@ -1131,7 +1171,9 @@ class Posterior(object):
|
|
|
1131
1171
|
self.bestp = bestp
|
|
1132
1172
|
self.statistics = statistics
|
|
1133
1173
|
self.quantile = quantile
|
|
1134
|
-
|
|
1174
|
+
if mask is None:
|
|
1175
|
+
mask = np.ones(self.npars, bool)
|
|
1176
|
+
self.mask = mask
|
|
1135
1177
|
|
|
1136
1178
|
def plot(
|
|
1137
1179
|
self, plot_marginal=True,
|
|
@@ -1143,6 +1185,7 @@ class Posterior(object):
|
|
|
1143
1185
|
show_texts=None, show_estimates=None,
|
|
1144
1186
|
show_colorbar=None,
|
|
1145
1187
|
savefile=None,
|
|
1188
|
+
nlevels=None,
|
|
1146
1189
|
):
|
|
1147
1190
|
"""
|
|
1148
1191
|
Plot marginal histograms and pairwise posteriors.
|
|
@@ -1156,6 +1199,8 @@ class Posterior(object):
|
|
|
1156
1199
|
show_texts = self.show_texts
|
|
1157
1200
|
if show_colorbar is None:
|
|
1158
1201
|
show_colorbar = self.show_colorbar
|
|
1202
|
+
if nlevels is None:
|
|
1203
|
+
nlevels = 6
|
|
1159
1204
|
|
|
1160
1205
|
fig = Figure(
|
|
1161
1206
|
self,
|
|
@@ -1171,10 +1216,12 @@ class Posterior(object):
|
|
|
1171
1216
|
fontsize=fontsize,
|
|
1172
1217
|
figsize=figsize,
|
|
1173
1218
|
fignum=fignum,
|
|
1219
|
+
normalization=self.normalization,
|
|
1174
1220
|
show_texts=show_texts,
|
|
1175
1221
|
show_estimates=show_estimates,
|
|
1176
1222
|
show_colorbar=show_colorbar,
|
|
1177
|
-
# bins=25,
|
|
1223
|
+
# bins=25,
|
|
1224
|
+
nlevels=nlevels,
|
|
1178
1225
|
)
|
|
1179
1226
|
self.figures.append(fig)
|
|
1180
1227
|
fig.plot(figure=figure, savefile=savefile)
|
|
@@ -1185,7 +1232,9 @@ class Posterior(object):
|
|
|
1185
1232
|
self, fignum=None, axes=None, quantile=None,
|
|
1186
1233
|
nx=None, ny=None,
|
|
1187
1234
|
savefile=None,
|
|
1235
|
+
fontsize=11, linewidth=1.5,
|
|
1188
1236
|
show_texts=None, show_estimates=None,
|
|
1237
|
+
alpha=0.6,
|
|
1189
1238
|
):
|
|
1190
1239
|
"""
|
|
1191
1240
|
Plot histogram of marginal posteriors.
|
|
@@ -1194,6 +1243,8 @@ class Posterior(object):
|
|
|
1194
1243
|
show_estimates = self.show_estimates
|
|
1195
1244
|
if show_texts is None:
|
|
1196
1245
|
show_texts = self.show_texts
|
|
1246
|
+
if quantile is None:
|
|
1247
|
+
quantile = self.quantile
|
|
1197
1248
|
|
|
1198
1249
|
fig = Marginal(
|
|
1199
1250
|
self,
|
|
@@ -1201,8 +1252,13 @@ class Posterior(object):
|
|
|
1201
1252
|
self.ranges, self.theme,
|
|
1202
1253
|
statistics=self.statistics,
|
|
1203
1254
|
nx=nx, ny=ny,
|
|
1255
|
+
quantile=quantile,
|
|
1256
|
+
fontsize=fontsize,
|
|
1257
|
+
linewidth=linewidth,
|
|
1258
|
+
normalization=self.normalization,
|
|
1204
1259
|
show_texts=show_texts,
|
|
1205
1260
|
show_estimates=show_estimates,
|
|
1261
|
+
alpha=alpha,
|
|
1206
1262
|
)
|
|
1207
1263
|
self.figures.append(fig)
|
|
1208
1264
|
fig.plot(savefile=savefile, fignum=fignum, axes=axes)
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
# Copyright (c) 2015-
|
|
1
|
+
# Copyright (c) 2015-2026 Patricio Cubillos and contributors.
|
|
2
2
|
# mc3 is open-source software under the MIT license (see LICENSE).
|
|
3
3
|
|
|
4
4
|
from .gelman import *
|
|
5
5
|
from .stats import *
|
|
6
6
|
from .time_averaging import *
|
|
7
|
+
from .dwt import *
|
|
7
8
|
from .prayer import *
|
|
8
9
|
|
|
9
10
|
__all__ = (
|
|
10
11
|
gelman.__all__
|
|
11
12
|
+ stats.__all__
|
|
12
13
|
+ time_averaging.__all__
|
|
14
|
+
+ dwt.__all__
|
|
13
15
|
+ prayer.__all__
|
|
14
16
|
)
|
|
15
17
|
|