mcsamplers 2026.9.4__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.
- mcsamplers-2026.9.4/.gitignore +181 -0
- mcsamplers-2026.9.4/LICENSE +21 -0
- mcsamplers-2026.9.4/PKG-INFO +122 -0
- mcsamplers-2026.9.4/README.md +89 -0
- mcsamplers-2026.9.4/docs/Makefile +20 -0
- mcsamplers-2026.9.4/docs/code.rst +21 -0
- mcsamplers-2026.9.4/docs/make.bat +35 -0
- mcsamplers-2026.9.4/docs/source/README +19 -0
- mcsamplers-2026.9.4/docs/source/conf.py +65 -0
- mcsamplers-2026.9.4/docs/source/index.rst +60 -0
- mcsamplers-2026.9.4/mcsamplers/__init__.py +6 -0
- mcsamplers-2026.9.4/mcsamplers/markov_chain/LICENSE +21 -0
- mcsamplers-2026.9.4/mcsamplers/markov_chain/README +19 -0
- mcsamplers-2026.9.4/mcsamplers/markov_chain/README.md +5 -0
- mcsamplers-2026.9.4/mcsamplers/markov_chain/__init__.py +1 -0
- mcsamplers-2026.9.4/mcsamplers/markov_chain/examples/MCMC_identity_test_serial_Feb9_2025.ipynb +325 -0
- mcsamplers-2026.9.4/mcsamplers/markov_chain/examples/MCMC_identity_test_serial_Feb9_2025_emcee.ipynb +675 -0
- mcsamplers-2026.9.4/mcsamplers/markov_chain/examples/MC_parallel.ipynb +87 -0
- mcsamplers-2026.9.4/mcsamplers/markov_chain/examples/MC_parallel_example.py +107 -0
- mcsamplers-2026.9.4/mcsamplers/markov_chain/examples/MC_serial_example.py +240 -0
- mcsamplers-2026.9.4/mcsamplers/markov_chain/examples/main.py +49 -0
- mcsamplers-2026.9.4/mcsamplers/markov_chain/examples/mcmc.py +8 -0
- mcsamplers-2026.9.4/mcsamplers/markov_chain/requirements.txt +7 -0
- mcsamplers-2026.9.4/mcsamplers/markov_chain/setup.py +24 -0
- mcsamplers-2026.9.4/mcsamplers/markov_chain/utils.py +170 -0
- mcsamplers-2026.9.4/mcsamplers/markov_chain/yumcee.py +736 -0
- mcsamplers-2026.9.4/mcsamplers/markov_chain/yumcee_p.py +278 -0
- mcsamplers-2026.9.4/mcsamplers/markov_chain/yumcee_utils.py +363 -0
- mcsamplers-2026.9.4/mcsamplers/markov_chain/yumcee_utils_old.py +144 -0
- mcsamplers-2026.9.4/mcsamplers/model.py +198 -0
- mcsamplers-2026.9.4/mcsamplers/nested/LICENSE +21 -0
- mcsamplers-2026.9.4/mcsamplers/nested/README +5 -0
- mcsamplers-2026.9.4/mcsamplers/nested/README.md +6 -0
- mcsamplers-2026.9.4/mcsamplers/nested/__init__.py +0 -0
- mcsamplers-2026.9.4/mcsamplers/nested/requirements.txt +5 -0
- mcsamplers-2026.9.4/mcsamplers/nested/sampler.py +605 -0
- mcsamplers-2026.9.4/mcsamplers/nested/setup.py +24 -0
- mcsamplers-2026.9.4/mcsamplers/tests/__init__.py +1 -0
- mcsamplers-2026.9.4/mcsamplers/tests/test_basic.py +236 -0
- mcsamplers-2026.9.4/mcsamplers/types.py +74 -0
- mcsamplers-2026.9.4/mcsamplers/utils.py +290 -0
- mcsamplers-2026.9.4/optional-requirements.txt +4 -0
- mcsamplers-2026.9.4/pyproject.toml +90 -0
- mcsamplers-2026.9.4/requirements.txt +13 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.txt
|
|
6
|
+
*.h5
|
|
7
|
+
*.json
|
|
8
|
+
*.pkl
|
|
9
|
+
*.pdf
|
|
10
|
+
*.orig
|
|
11
|
+
*.txt
|
|
12
|
+
*.png
|
|
13
|
+
*.json
|
|
14
|
+
*.gwf
|
|
15
|
+
*.h5
|
|
16
|
+
*.hdf5
|
|
17
|
+
*.log
|
|
18
|
+
# C extensions
|
|
19
|
+
*.so
|
|
20
|
+
*.npy
|
|
21
|
+
*.npz
|
|
22
|
+
|
|
23
|
+
# Distribution / packaging
|
|
24
|
+
.Python
|
|
25
|
+
build/
|
|
26
|
+
develop-eggs/
|
|
27
|
+
dist/
|
|
28
|
+
downloads/
|
|
29
|
+
eggs/
|
|
30
|
+
.eggs/
|
|
31
|
+
lib/
|
|
32
|
+
lib64/
|
|
33
|
+
parts/
|
|
34
|
+
sdist/
|
|
35
|
+
var/
|
|
36
|
+
wheels/
|
|
37
|
+
share/python-wheels/
|
|
38
|
+
*.egg-info/
|
|
39
|
+
.installed.cfg
|
|
40
|
+
*.egg
|
|
41
|
+
MANIFEST
|
|
42
|
+
|
|
43
|
+
# PyInstaller
|
|
44
|
+
# Usually these files are written by a python script from a template
|
|
45
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
46
|
+
*.manifest
|
|
47
|
+
*.spec
|
|
48
|
+
|
|
49
|
+
# Installer logs
|
|
50
|
+
pip-log.txt
|
|
51
|
+
pip-delete-this-directory.txt
|
|
52
|
+
|
|
53
|
+
# Unit test / coverage reports
|
|
54
|
+
htmlcov/
|
|
55
|
+
.tox/
|
|
56
|
+
.nox/
|
|
57
|
+
.coverage
|
|
58
|
+
.coverage.*
|
|
59
|
+
.cache
|
|
60
|
+
nosetests.xml
|
|
61
|
+
coverage.xml
|
|
62
|
+
*.cover
|
|
63
|
+
*.py,cover
|
|
64
|
+
.hypothesis/
|
|
65
|
+
.pytest_cache/
|
|
66
|
+
cover/
|
|
67
|
+
|
|
68
|
+
# Translations
|
|
69
|
+
*.mo
|
|
70
|
+
*.pot
|
|
71
|
+
|
|
72
|
+
# Django stuff:
|
|
73
|
+
*.log
|
|
74
|
+
local_settings.py
|
|
75
|
+
db.sqlite3
|
|
76
|
+
db.sqlite3-journal
|
|
77
|
+
|
|
78
|
+
# Flask stuff:
|
|
79
|
+
instance/
|
|
80
|
+
.webassets-cache
|
|
81
|
+
|
|
82
|
+
# Scrapy stuff:
|
|
83
|
+
.scrapy
|
|
84
|
+
|
|
85
|
+
# Sphinx documentation
|
|
86
|
+
docs/_build/
|
|
87
|
+
|
|
88
|
+
# PyBuilder
|
|
89
|
+
.pybuilder/
|
|
90
|
+
target/
|
|
91
|
+
|
|
92
|
+
# Jupyter Notebook
|
|
93
|
+
.ipynb_checkpoints
|
|
94
|
+
|
|
95
|
+
# IPython
|
|
96
|
+
profile_default/
|
|
97
|
+
ipython_config.py
|
|
98
|
+
|
|
99
|
+
# pyenv
|
|
100
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
101
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
102
|
+
# .python-version
|
|
103
|
+
|
|
104
|
+
# pipenv
|
|
105
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
106
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
107
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
108
|
+
# install all needed dependencies.
|
|
109
|
+
#Pipfile.lock
|
|
110
|
+
|
|
111
|
+
# poetry
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
113
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
114
|
+
# commonly ignored for libraries.
|
|
115
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
116
|
+
#poetry.lock
|
|
117
|
+
|
|
118
|
+
# pdm
|
|
119
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
120
|
+
#pdm.lock
|
|
121
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
122
|
+
# in version control.
|
|
123
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
124
|
+
.pdm.toml
|
|
125
|
+
|
|
126
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
127
|
+
__pypackages__/
|
|
128
|
+
|
|
129
|
+
# Celery stuff
|
|
130
|
+
celerybeat-schedule
|
|
131
|
+
celerybeat.pid
|
|
132
|
+
|
|
133
|
+
# SageMath parsed files
|
|
134
|
+
*.sage.py
|
|
135
|
+
|
|
136
|
+
# Environments
|
|
137
|
+
.env
|
|
138
|
+
.venv
|
|
139
|
+
env/
|
|
140
|
+
venv/
|
|
141
|
+
ENV/
|
|
142
|
+
env.bak/
|
|
143
|
+
venv.bak/
|
|
144
|
+
|
|
145
|
+
# Spyder project settings
|
|
146
|
+
.spyderproject
|
|
147
|
+
.spyproject
|
|
148
|
+
|
|
149
|
+
# Rope project settings
|
|
150
|
+
.ropeproject
|
|
151
|
+
|
|
152
|
+
# mkdocs documentation
|
|
153
|
+
/site
|
|
154
|
+
|
|
155
|
+
# mypy
|
|
156
|
+
.mypy_cache/
|
|
157
|
+
.dmypy.json
|
|
158
|
+
dmypy.json
|
|
159
|
+
|
|
160
|
+
# Pyre type checker
|
|
161
|
+
.pyre/
|
|
162
|
+
|
|
163
|
+
# pytype static type analyzer
|
|
164
|
+
.pytype/
|
|
165
|
+
|
|
166
|
+
# Cython debug symbols
|
|
167
|
+
cython_debug/
|
|
168
|
+
|
|
169
|
+
# PyCharm
|
|
170
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
171
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
172
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
173
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
174
|
+
#.idea/
|
|
175
|
+
|
|
176
|
+
# The packaging framework (hatch-requirements-txt) READS these at build time,
|
|
177
|
+
# so a blanket *.txt above would leave a clone unbuildable: pip clones, hatch
|
|
178
|
+
# looks for requirements.txt, and metadata generation fails with
|
|
179
|
+
# FileNotFoundError. They must be tracked.
|
|
180
|
+
!requirements.txt
|
|
181
|
+
!optional-requirements.txt
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020-2026 Vaishak Prasad
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: mcsamplers
|
|
3
|
+
Version: 2026.9.4
|
|
4
|
+
Summary: Monte-Carlo samplers for gravitational-wave parameter estimation: nested sampling and MCMC
|
|
5
|
+
Project-URL: Homepage, https://gitlab.com/vaishakp/parameter-estimation
|
|
6
|
+
Project-URL: Bug Tracker, https://gitlab.com/vaishakp/parameter-estimation/-/issues
|
|
7
|
+
Author-email: Vaishak Prasad <vaishakprasad@gmail.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Astronomy
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
19
|
+
Requires-Python: >=3.11
|
|
20
|
+
Requires-Dist: corner
|
|
21
|
+
Requires-Dist: h5py
|
|
22
|
+
Requires-Dist: matplotlib
|
|
23
|
+
Requires-Dist: numpy
|
|
24
|
+
Requires-Dist: psutil
|
|
25
|
+
Requires-Dist: scipy
|
|
26
|
+
Requires-Dist: sympy
|
|
27
|
+
Requires-Dist: tqdm
|
|
28
|
+
Requires-Dist: waveformtools
|
|
29
|
+
Provides-Extra: opt
|
|
30
|
+
Requires-Dist: pytest; extra == 'opt'
|
|
31
|
+
Requires-Dist: schwimmbad; extra == 'opt'
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# mcsamplers
|
|
35
|
+
|
|
36
|
+
Monte-Carlo stochastic samplers for gravitational-wave parameter estimation:
|
|
37
|
+
nested sampling and MCMC, built around a small `Model` base class that you
|
|
38
|
+
subclass with your own likelihood.
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install mcsamplers
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Requires Python 3.11+.
|
|
45
|
+
|
|
46
|
+
## The `Model` contract
|
|
47
|
+
|
|
48
|
+
Everything here works against one abstraction. Subclass `Model`, implement
|
|
49
|
+
`evaluate_logliklihood`, and the reduced-coordinate machinery comes with it:
|
|
50
|
+
the samplers explore the unit cube `[0, 1]^ndim`, and `Model` maps those
|
|
51
|
+
points onto your physical priors before calling you.
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
import numpy as np
|
|
55
|
+
from mcsamplers.model import Model
|
|
56
|
+
|
|
57
|
+
class Gaussian(Model):
|
|
58
|
+
def evaluate_logliklihood(self, parameters):
|
|
59
|
+
return -0.5 * float(np.sum(np.asarray(parameters) ** 2))
|
|
60
|
+
|
|
61
|
+
model = Gaussian(
|
|
62
|
+
xdata=np.linspace(0, 1, 64),
|
|
63
|
+
ydata=np.zeros(64),
|
|
64
|
+
initial_guess=[0.5, 0.5],
|
|
65
|
+
parameter_priors_dict={"a": [0.0, 2.0], "b": [-1.0, 1.0]},
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
# Unit cube in, physical parameters out: (0.5, 0.5) -> (1.0, 0.0)
|
|
69
|
+
model.evaluate_logliklihood_reduced(np.array([0.5, 0.5]))
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Priors are uniform boxes given as `{name: [min, max]}`. `Model` also supplies
|
|
73
|
+
`evaluate_liklihood`, `ln_prior_probability`, `pushforward_samples` and the
|
|
74
|
+
pickle round trip the samplers use for checkpointing.
|
|
75
|
+
|
|
76
|
+
## Nested sampling
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
from mcsamplers.nested.sampler import NestedSampler
|
|
80
|
+
|
|
81
|
+
sampler = NestedSampler(n_live=500, n_dim=2, n_iter=5000, Model=model)
|
|
82
|
+
sampler.run()
|
|
83
|
+
|
|
84
|
+
samples = sampler.posterior_samples
|
|
85
|
+
log_z = sampler.logevidence
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
New live points are drawn according to `random_sample_method`, one of
|
|
89
|
+
`prior`, `mcmc`, `random-distance` or `relative-centroid`. Runs can be
|
|
90
|
+
checkpointed and resumed with `restart=True` and `checkpoint_time_stamps`.
|
|
91
|
+
|
|
92
|
+
## MCMC
|
|
93
|
+
|
|
94
|
+
`mcsamplers.markov_chain.yumcee` is a Metropolis–Hastings sampler with
|
|
95
|
+
multiple walkers:
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
from mcsamplers.markov_chain.yumcee import yumcee_run
|
|
99
|
+
|
|
100
|
+
samples = yumcee_run(loglik, iguess, ndim, nwalkers, nsteps, prop_sigma)
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
`yumcee_p` is a parallel variant intended to run across nodes, and
|
|
104
|
+
`yumcee_utils` holds autocorrelation, corner-plot and sample-statistics
|
|
105
|
+
helpers.
|
|
106
|
+
|
|
107
|
+
## Tests
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
pip install mcsamplers[opt]
|
|
111
|
+
pytest --pyargs mcsamplers.tests
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Status and caveats
|
|
115
|
+
|
|
116
|
+
This is research code — used in anger, but not hardened for general use. The
|
|
117
|
+
test suite pins the `Model` contract, not sampling correctness: the samplers
|
|
118
|
+
themselves have no numerical regression tests.
|
|
119
|
+
|
|
120
|
+
## Licence
|
|
121
|
+
|
|
122
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# mcsamplers
|
|
2
|
+
|
|
3
|
+
Monte-Carlo stochastic samplers for gravitational-wave parameter estimation:
|
|
4
|
+
nested sampling and MCMC, built around a small `Model` base class that you
|
|
5
|
+
subclass with your own likelihood.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install mcsamplers
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Requires Python 3.11+.
|
|
12
|
+
|
|
13
|
+
## The `Model` contract
|
|
14
|
+
|
|
15
|
+
Everything here works against one abstraction. Subclass `Model`, implement
|
|
16
|
+
`evaluate_logliklihood`, and the reduced-coordinate machinery comes with it:
|
|
17
|
+
the samplers explore the unit cube `[0, 1]^ndim`, and `Model` maps those
|
|
18
|
+
points onto your physical priors before calling you.
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
import numpy as np
|
|
22
|
+
from mcsamplers.model import Model
|
|
23
|
+
|
|
24
|
+
class Gaussian(Model):
|
|
25
|
+
def evaluate_logliklihood(self, parameters):
|
|
26
|
+
return -0.5 * float(np.sum(np.asarray(parameters) ** 2))
|
|
27
|
+
|
|
28
|
+
model = Gaussian(
|
|
29
|
+
xdata=np.linspace(0, 1, 64),
|
|
30
|
+
ydata=np.zeros(64),
|
|
31
|
+
initial_guess=[0.5, 0.5],
|
|
32
|
+
parameter_priors_dict={"a": [0.0, 2.0], "b": [-1.0, 1.0]},
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
# Unit cube in, physical parameters out: (0.5, 0.5) -> (1.0, 0.0)
|
|
36
|
+
model.evaluate_logliklihood_reduced(np.array([0.5, 0.5]))
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Priors are uniform boxes given as `{name: [min, max]}`. `Model` also supplies
|
|
40
|
+
`evaluate_liklihood`, `ln_prior_probability`, `pushforward_samples` and the
|
|
41
|
+
pickle round trip the samplers use for checkpointing.
|
|
42
|
+
|
|
43
|
+
## Nested sampling
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
from mcsamplers.nested.sampler import NestedSampler
|
|
47
|
+
|
|
48
|
+
sampler = NestedSampler(n_live=500, n_dim=2, n_iter=5000, Model=model)
|
|
49
|
+
sampler.run()
|
|
50
|
+
|
|
51
|
+
samples = sampler.posterior_samples
|
|
52
|
+
log_z = sampler.logevidence
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
New live points are drawn according to `random_sample_method`, one of
|
|
56
|
+
`prior`, `mcmc`, `random-distance` or `relative-centroid`. Runs can be
|
|
57
|
+
checkpointed and resumed with `restart=True` and `checkpoint_time_stamps`.
|
|
58
|
+
|
|
59
|
+
## MCMC
|
|
60
|
+
|
|
61
|
+
`mcsamplers.markov_chain.yumcee` is a Metropolis–Hastings sampler with
|
|
62
|
+
multiple walkers:
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
from mcsamplers.markov_chain.yumcee import yumcee_run
|
|
66
|
+
|
|
67
|
+
samples = yumcee_run(loglik, iguess, ndim, nwalkers, nsteps, prop_sigma)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
`yumcee_p` is a parallel variant intended to run across nodes, and
|
|
71
|
+
`yumcee_utils` holds autocorrelation, corner-plot and sample-statistics
|
|
72
|
+
helpers.
|
|
73
|
+
|
|
74
|
+
## Tests
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pip install mcsamplers[opt]
|
|
78
|
+
pytest --pyargs mcsamplers.tests
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Status and caveats
|
|
82
|
+
|
|
83
|
+
This is research code — used in anger, but not hardened for general use. The
|
|
84
|
+
test suite pins the `Model` contract, not sampling correctness: the samplers
|
|
85
|
+
themselves have no numerical regression tests.
|
|
86
|
+
|
|
87
|
+
## Licence
|
|
88
|
+
|
|
89
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Minimal makefile for Sphinx documentation
|
|
2
|
+
#
|
|
3
|
+
|
|
4
|
+
# You can set these variables from the command line, and also
|
|
5
|
+
# from the environment for the first two.
|
|
6
|
+
SPHINXOPTS ?=
|
|
7
|
+
SPHINXBUILD ?= sphinx-build
|
|
8
|
+
SOURCEDIR = source
|
|
9
|
+
BUILDDIR = build
|
|
10
|
+
|
|
11
|
+
# Put it first so that "make" without argument is like "make help".
|
|
12
|
+
help:
|
|
13
|
+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
14
|
+
|
|
15
|
+
.PHONY: help Makefile
|
|
16
|
+
|
|
17
|
+
# Catch-all target: route all unknown targets to Sphinx using the new
|
|
18
|
+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
|
19
|
+
%: Makefile
|
|
20
|
+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Serial Monte Carlo intro
|
|
2
|
+
========================
|
|
3
|
+
.. automodule:: MCMC.readme
|
|
4
|
+
:members:
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Serial Monte Carlo sampler
|
|
8
|
+
==========================
|
|
9
|
+
.. automodule:: MCMC.yumcee
|
|
10
|
+
:members:
|
|
11
|
+
|
|
12
|
+
Monte Carlo utils
|
|
13
|
+
=================
|
|
14
|
+
.. automodule:: MCMC.yumcee_utils
|
|
15
|
+
:members:
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
Parallel Monte Carlo sampler
|
|
19
|
+
============================
|
|
20
|
+
.. automodule:: MCMC.yumcee_p
|
|
21
|
+
:members:
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
@ECHO OFF
|
|
2
|
+
|
|
3
|
+
pushd %~dp0
|
|
4
|
+
|
|
5
|
+
REM Command file for Sphinx documentation
|
|
6
|
+
|
|
7
|
+
if "%SPHINXBUILD%" == "" (
|
|
8
|
+
set SPHINXBUILD=sphinx-build
|
|
9
|
+
)
|
|
10
|
+
set SOURCEDIR=source
|
|
11
|
+
set BUILDDIR=build
|
|
12
|
+
|
|
13
|
+
if "%1" == "" goto help
|
|
14
|
+
|
|
15
|
+
%SPHINXBUILD% >NUL 2>NUL
|
|
16
|
+
if errorlevel 9009 (
|
|
17
|
+
echo.
|
|
18
|
+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
|
19
|
+
echo.installed, then set the SPHINXBUILD environment variable to point
|
|
20
|
+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
|
21
|
+
echo.may add the Sphinx directory to PATH.
|
|
22
|
+
echo.
|
|
23
|
+
echo.If you don't have Sphinx installed, grab it from
|
|
24
|
+
echo.http://sphinx-doc.org/
|
|
25
|
+
exit /b 1
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
29
|
+
goto end
|
|
30
|
+
|
|
31
|
+
:help
|
|
32
|
+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
33
|
+
|
|
34
|
+
:end
|
|
35
|
+
popd
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Markov Chain Monte Carlo project: yumcee.
|
|
2
|
+
|
|
3
|
+
yumcee: Serial MCMC
|
|
4
|
+
yumcee_p : MCMC implemented with mpi4py
|
|
5
|
+
yumcee_utils: Various utilities for Statistics of samples
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
This library contains Monte Carlo samplers.
|
|
9
|
+
|
|
10
|
+
1. Serial Markov chain Monte Carlo.
|
|
11
|
+
2. Parallel Markov chain Monte Carlo.
|
|
12
|
+
3. Setial Nested sampler.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
The MCMC is a very basic MCMC samplers with a static poposal sigma, which can be controlled. This is capable of running multi dimensional, multi walker MCMC.
|
|
16
|
+
|
|
17
|
+
The Nested smapler is under construction.
|
|
18
|
+
|
|
19
|
+
More details can be found in the wiki page of the gitlab repository.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Configuration file for the Sphinx documentation builder.
|
|
2
|
+
#
|
|
3
|
+
# This file only contains a selection of the most common options. For a full
|
|
4
|
+
# list see the documentation:
|
|
5
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
|
6
|
+
|
|
7
|
+
# -- Path setup --------------------------------------------------------------
|
|
8
|
+
|
|
9
|
+
# If extensions (or modules to document with autodoc) are in another directory,
|
|
10
|
+
# add these directories to sys.path here. If the directory is relative to the
|
|
11
|
+
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
|
12
|
+
#
|
|
13
|
+
import os
|
|
14
|
+
import sys
|
|
15
|
+
|
|
16
|
+
sys.path.insert(0, os.path.abspath("../.."))
|
|
17
|
+
sys.setrecursionlimit(1500)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
# -- Project information -----------------------------------------------------
|
|
21
|
+
|
|
22
|
+
project = "Parameter estimation"
|
|
23
|
+
copyright = "2020, Vaishak P"
|
|
24
|
+
author = "Vaishak P"
|
|
25
|
+
|
|
26
|
+
# The full version, including alpha/beta/rc tags
|
|
27
|
+
release = "2020"
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# -- General configuration ---------------------------------------------------
|
|
31
|
+
|
|
32
|
+
# Add any Sphinx extension module names here, as strings. They can be
|
|
33
|
+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
|
34
|
+
# ones.
|
|
35
|
+
extensions = ["rinoh.frontend.sphinx", "sphinx.ext.autodoc"]
|
|
36
|
+
|
|
37
|
+
# Add any paths that contain templates here, relative to this directory.
|
|
38
|
+
templates_path = ["_templates"]
|
|
39
|
+
|
|
40
|
+
# List of patterns, relative to source directory, that match files and
|
|
41
|
+
# directories to ignore when looking for source files.
|
|
42
|
+
# This pattern also affects html_static_path and html_extra_path.
|
|
43
|
+
exclude_patterns = []
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
# -- Options for HTML output -------------------------------------------------
|
|
47
|
+
|
|
48
|
+
# The theme to use for HTML and HTML Help pages. See the documentation for
|
|
49
|
+
# a list of builtin themes.
|
|
50
|
+
#
|
|
51
|
+
html_theme = "sphinx_rtd_theme"
|
|
52
|
+
|
|
53
|
+
# Add any paths that contain custom static files (such as style sheets) here,
|
|
54
|
+
# relative to this directory. They are copied after the builtin static files,
|
|
55
|
+
# so a file named "default.css" will overwrite the builtin "default.css".
|
|
56
|
+
html_static_path = ["_static"]
|
|
57
|
+
|
|
58
|
+
# -- Options for LaTeX output ------------------------------------------------
|
|
59
|
+
|
|
60
|
+
latex_elements = {
|
|
61
|
+
"papersize": "letterpaper",
|
|
62
|
+
"pointsize": "10pt",
|
|
63
|
+
"preamble": "",
|
|
64
|
+
"figure_align": "htbp",
|
|
65
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
.. Parameter estimation documentation master file, created by
|
|
2
|
+
sphinx-quickstart on Wed Jul 8 14:13:27 2020.
|
|
3
|
+
You can adapt this file completely to your liking, but it should at least
|
|
4
|
+
contain the root `toctree` directive.
|
|
5
|
+
|
|
6
|
+
Welcome to Parameter estimation's documentation!
|
|
7
|
+
================================================
|
|
8
|
+
|
|
9
|
+
*yumcee*, is a very basic, working, MPI based- Monte-Carlo sampler and a set of tools for barrying out Bayesian parameter estimation.
|
|
10
|
+
|
|
11
|
+
It is implemented in python using MPI for parallelism, and thus scalable to large systems. It consists of:
|
|
12
|
+
|
|
13
|
+
1. A markov chain Monte-Carlo (MCMC) sampler.
|
|
14
|
+
|
|
15
|
+
2. A nested Monte-Carlo sampler (in works).
|
|
16
|
+
|
|
17
|
+
3. Tools for parameter-estimation.
|
|
18
|
+
|
|
19
|
+
4. Retreiving the statistical properties of the posteriors from the chains:
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
a). mean/mode.
|
|
23
|
+
|
|
24
|
+
b). standard deviation.
|
|
25
|
+
|
|
26
|
+
6. Plotting the posteriors.
|
|
27
|
+
|
|
28
|
+
7. Miscellaneous tools
|
|
29
|
+
|
|
30
|
+
Saving the chains, results to the disk.
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
.. toctree::
|
|
35
|
+
:maxdepth: 2
|
|
36
|
+
:caption: Contents:
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
Serial Monte Carlo intro
|
|
40
|
+
========================
|
|
41
|
+
.. include:: README
|
|
42
|
+
.. automodule:: MCMC.README
|
|
43
|
+
:members:
|
|
44
|
+
:download: `<README>`
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
Serial Monte Carlo sampler
|
|
48
|
+
==========================
|
|
49
|
+
.. automodule:: MCMC.yumcee
|
|
50
|
+
:members:
|
|
51
|
+
|
|
52
|
+
Monte Carlo utils
|
|
53
|
+
=================
|
|
54
|
+
.. automodule:: MCMC.yumcee_utils
|
|
55
|
+
:members:
|
|
56
|
+
|
|
57
|
+
Parallel Monte Carlo sampler
|
|
58
|
+
============================
|
|
59
|
+
.. automodule:: MCMC.yumcee_p
|
|
60
|
+
:members:
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"""Monte-Carlo samplers: nested sampling and MCMC."""
|
|
2
|
+
|
|
3
|
+
# Written in PEP 440 normal form. A zero-padded "2026.09.04" would normalise
|
|
4
|
+
# to "2026.9.4" on the built distribution, leaving __version__ disagreeing
|
|
5
|
+
# with importlib.metadata.version("mcsamplers") for the life of the release.
|
|
6
|
+
__version__ = "2026.9.4"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) [2020] [Vaishak Prasad]
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Markov Chain Monte Carlo project: yumcee.
|
|
2
|
+
|
|
3
|
+
yumcee: Serial MCMC
|
|
4
|
+
yumcee_p : MCMC implemented with mpi4py
|
|
5
|
+
yumcee_utils: Various utilities for Statistics of samples
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
This library contains Monte Carlo samplers.
|
|
9
|
+
|
|
10
|
+
1. Serial Markov chain Monte Carlo.
|
|
11
|
+
2. Parallel Markov chain Monte Carlo.
|
|
12
|
+
3. Setial Nested sampler.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
The MCMC is a very basic MCMC samplers with a static poposal sigma, which can be controlled. This is capable of running multi dimensional, multi walker MCMC.
|
|
16
|
+
|
|
17
|
+
The Nested smapler is under construction.
|
|
18
|
+
|
|
19
|
+
More details can be found in the wiki page of the gitlab repository.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Markov-chain Monte Carlo samplers (yumcee, serial and parallel)."""
|