eryn 1.2.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.
Files changed (39) hide show
  1. eryn-1.2.0/PKG-INFO +167 -0
  2. eryn-1.2.0/README.md +119 -0
  3. eryn-1.2.0/pyproject.toml +87 -0
  4. eryn-1.2.0/src/eryn/CMakeLists.txt +51 -0
  5. eryn-1.2.0/src/eryn/__init__.py +35 -0
  6. eryn-1.2.0/src/eryn/backends/__init__.py +20 -0
  7. eryn-1.2.0/src/eryn/backends/backend.py +1150 -0
  8. eryn-1.2.0/src/eryn/backends/hdfbackend.py +819 -0
  9. eryn-1.2.0/src/eryn/ensemble.py +1690 -0
  10. eryn-1.2.0/src/eryn/git_version.py.in +7 -0
  11. eryn-1.2.0/src/eryn/model.py +18 -0
  12. eryn-1.2.0/src/eryn/moves/__init__.py +42 -0
  13. eryn-1.2.0/src/eryn/moves/combine.py +135 -0
  14. eryn-1.2.0/src/eryn/moves/delayedrejection.py +229 -0
  15. eryn-1.2.0/src/eryn/moves/distgen.py +104 -0
  16. eryn-1.2.0/src/eryn/moves/distgenrj.py +222 -0
  17. eryn-1.2.0/src/eryn/moves/gaussian.py +190 -0
  18. eryn-1.2.0/src/eryn/moves/group.py +281 -0
  19. eryn-1.2.0/src/eryn/moves/groupstretch.py +120 -0
  20. eryn-1.2.0/src/eryn/moves/mh.py +193 -0
  21. eryn-1.2.0/src/eryn/moves/move.py +703 -0
  22. eryn-1.2.0/src/eryn/moves/mtdistgen.py +137 -0
  23. eryn-1.2.0/src/eryn/moves/mtdistgenrj.py +190 -0
  24. eryn-1.2.0/src/eryn/moves/multipletry.py +776 -0
  25. eryn-1.2.0/src/eryn/moves/red_blue.py +333 -0
  26. eryn-1.2.0/src/eryn/moves/rj.py +388 -0
  27. eryn-1.2.0/src/eryn/moves/stretch.py +231 -0
  28. eryn-1.2.0/src/eryn/moves/tempering.py +649 -0
  29. eryn-1.2.0/src/eryn/pbar.py +56 -0
  30. eryn-1.2.0/src/eryn/prior.py +452 -0
  31. eryn-1.2.0/src/eryn/state.py +775 -0
  32. eryn-1.2.0/src/eryn/tests/__init__.py +0 -0
  33. eryn-1.2.0/src/eryn/tests/test_eryn.py +1246 -0
  34. eryn-1.2.0/src/eryn/utils/__init__.py +10 -0
  35. eryn-1.2.0/src/eryn/utils/periodic.py +134 -0
  36. eryn-1.2.0/src/eryn/utils/stopping.py +164 -0
  37. eryn-1.2.0/src/eryn/utils/transform.py +226 -0
  38. eryn-1.2.0/src/eryn/utils/updates.py +69 -0
  39. eryn-1.2.0/src/eryn/utils/utility.py +329 -0
eryn-1.2.0/PKG-INFO ADDED
@@ -0,0 +1,167 @@
1
+ Metadata-Version: 2.3
2
+ Name: eryn
3
+ Version: 1.2.0
4
+ Summary: Eryn: an omni-MCMC sampling package.
5
+ Author: Michael Katz
6
+ Author-email: Michael Katz <mikekatz04@gmail.com>
7
+ Classifier: License :: OSI Approved :: Apache Software License
8
+ Classifier: Natural Language :: English
9
+ Classifier: Programming Language :: C++
10
+ Classifier: Programming Language :: Cython
11
+ Classifier: Programming Language :: Python :: 3 :: Only
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Requires-Dist: exceptiongroup ; python_full_version < '3.11'
18
+ Requires-Dist: h5py
19
+ Requires-Dist: jsonschema
20
+ Requires-Dist: matplotlib
21
+ Requires-Dist: numpy
22
+ Requires-Dist: nvidia-ml-py
23
+ Requires-Dist: platformdirs
24
+ Requires-Dist: pydantic
25
+ Requires-Dist: pyyaml
26
+ Requires-Dist: requests
27
+ Requires-Dist: rich
28
+ Requires-Dist: scipy
29
+ Requires-Dist: tqdm
30
+ Requires-Dist: wrapt
31
+ Requires-Dist: ipykernel ; extra == 'doc'
32
+ Requires-Dist: ipython ; extra == 'doc'
33
+ Requires-Dist: ipywidgets ; extra == 'doc'
34
+ Requires-Dist: myst-parser ; extra == 'doc'
35
+ Requires-Dist: nbsphinx ; extra == 'doc'
36
+ Requires-Dist: pypandoc ; extra == 'doc'
37
+ Requires-Dist: sphinx ; extra == 'doc'
38
+ Requires-Dist: sphinx-rtd-theme ; extra == 'doc'
39
+ Requires-Dist: sphinx-tippy ; extra == 'doc'
40
+ Requires-Dist: corner ; extra == 'doc'
41
+ Requires-Dist: matplotlib ; extra == 'testing'
42
+ Requires-Dist: corner ; extra == 'testing'
43
+ Requires-Dist: chainconsumer ; extra == 'testing'
44
+ Requires-Python: >=3.9
45
+ Provides-Extra: doc
46
+ Provides-Extra: testing
47
+ Description-Content-Type: text/markdown
48
+
49
+ # Eryn: a multi-purpose MCMC sampler
50
+
51
+ Eryn is an advanced MCMC sampler. It has the capability to run with parallel tempering, multiple model types, and unknown counts within each model type using Reversible Jump MCMC techniques. Eryn is heavily based on [emcee](https://emcee.readthedocs.io/en/stable/). The `emcee` base structure with the Ensemble Sampler, State objects, proposal setup, and storage backends is carried over into Eryn with small changes to account for the increased complexity. In a simple sense, Eryn is an advanced (and slightly more complicated) version of `emcee`.
52
+
53
+ If you use Eryn in your publication, please cite the paper [arXiv:2303.02164](https://arxiv.org/abs/2303.02164), its [zenodo](https://zenodo.org/record/7705496#.ZAhzukJKjlw), and [emcee](https://emcee.readthedocs.io/en/stable/). The documentation for Eryn can be found here: [mikekatz04.github.io/Eryn](https://mikekatz04.github.io/Eryn). You will find the code on Github: [github.com/mikekatz04/Eryn](https://github.com/mikekatz04/Eryn).
54
+
55
+ ## Getting Started
56
+
57
+ Below is a quick set of instructions to get you started with `eryn`.
58
+
59
+ ```
60
+ pip install eryn
61
+ ```
62
+ To import eryn:
63
+
64
+ ```
65
+ from eryn.ensemble import EnsembleSampler
66
+ ```
67
+
68
+ See [examples notebook](https://github.com/mikekatz04/Eryn/blob/main/examples/Eryn_tutorial.ipynb) for more info. You can also navigate the [Documentation](https://mikekatz04.github.io/Eryn/html/index.html) pages.
69
+
70
+
71
+ ### Prerequisites
72
+
73
+ Eryn has only a few python-based dependencies: `tqdm`, `corner` for plotting, `numpy`, `matplotlib`.
74
+
75
+ ### Installing
76
+
77
+ If you are not planning to develop the code, you can just install the latest version with the pip installation technique given above. Otherwise, you can just clone the repo and run `pip install .` inside of the Eryn directory. To run tests on Eryn during development, you can run the following in the main Eryn directory:
78
+ ```
79
+ python -m unittest discover
80
+ ```
81
+
82
+
83
+ ## Running the Tests
84
+
85
+ In the main directory of the package run in the terminal:
86
+ ```
87
+ python -m unittest discover
88
+ ```
89
+
90
+
91
+ ## Contributing
92
+
93
+ Please read [CONTRIBUTING.md](CONTRIBUTING) for details on our code of conduct, and the process for submitting pull requests to us.
94
+
95
+ ## Versioning
96
+
97
+ We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/mikekatz04/Eryn/tags).
98
+
99
+ ## Citation
100
+
101
+ When using this package, please cite at minimum the following sources:
102
+
103
+ ```
104
+ @article{Karnesis:2023ras,
105
+ author = "Karnesis, Nikolaos and Katz, Michael L. and Korsakova, Natalia and Gair, Jonathan R. and Stergioulas, Nikolaos",
106
+ title = "{Eryn : A multi-purpose sampler for Bayesian inference}",
107
+ eprint = "2303.02164",
108
+ archivePrefix = "arXiv",
109
+ primaryClass = "astro-ph.IM",
110
+ month = "3",
111
+ year = "2023"
112
+ }
113
+
114
+ @software{michael_katz_2023_7705496,
115
+ author = {Michael Katz and
116
+ Nikolaos Karnesis and
117
+ Natalia Korsakova},
118
+ title = {mikekatz04/Eryn: first full release},
119
+ month = mar,
120
+ year = 2023,
121
+ publisher = {Zenodo},
122
+ version = {v1.0.0},
123
+ doi = {10.5281/zenodo.7705496},
124
+ url = {https://doi.org/10.5281/zenodo.7705496}
125
+ }
126
+
127
+ @ARTICLE{2013PASP..125..306F,
128
+ author = {{Foreman-Mackey}, Daniel and {Hogg}, David W. and {Lang}, Dustin and {Goodman}, Jonathan},
129
+ title = "{emcee: The MCMC Hammer}",
130
+ journal = {\pasp},
131
+ keywords = {Astrophysics - Instrumentation and Methods for Astrophysics, Physics - Computational Physics, Statistics - Computation},
132
+ year = 2013,
133
+ month = mar,
134
+ volume = {125},
135
+ number = {925},
136
+ pages = {306},
137
+ doi = {10.1086/670067},
138
+ archivePrefix = {arXiv},
139
+ eprint = {1202.3665},
140
+ primaryClass = {astro-ph.IM},
141
+ adsurl = {https://ui.adsabs.harvard.edu/abs/2013PASP..125..306F},
142
+ adsnote = {Provided by the SAO/NASA Astrophysics Data System}
143
+ }
144
+
145
+ ```
146
+
147
+ Depending on which proposals are used, you may be required to cite more sources. Please make sure you do this properly.
148
+
149
+ ## Authors
150
+
151
+ * **Michael Katz**
152
+ * Nikos Karnesis
153
+ * Natalia Korsakova
154
+ * Jonathan Gair
155
+
156
+ ### Contibutors
157
+
158
+ * Maybe you!
159
+
160
+ ## License
161
+
162
+ This project is licensed under the GNU License - see the [LICENSE.md](LICENSE) file for details.
163
+
164
+ ## Acknowledgments
165
+
166
+ * We wish to thank S. Babak, M. Le Jeune, S. Marsat, T. Littenberg, and N. Cornish for their useful comments and very fruitful discussions.
167
+ * N Stergioulas and N Karnesis acknowledge support from the Gr-PRODEX 2019 funding program (PEA 4000132310).
eryn-1.2.0/README.md ADDED
@@ -0,0 +1,119 @@
1
+ # Eryn: a multi-purpose MCMC sampler
2
+
3
+ Eryn is an advanced MCMC sampler. It has the capability to run with parallel tempering, multiple model types, and unknown counts within each model type using Reversible Jump MCMC techniques. Eryn is heavily based on [emcee](https://emcee.readthedocs.io/en/stable/). The `emcee` base structure with the Ensemble Sampler, State objects, proposal setup, and storage backends is carried over into Eryn with small changes to account for the increased complexity. In a simple sense, Eryn is an advanced (and slightly more complicated) version of `emcee`.
4
+
5
+ If you use Eryn in your publication, please cite the paper [arXiv:2303.02164](https://arxiv.org/abs/2303.02164), its [zenodo](https://zenodo.org/record/7705496#.ZAhzukJKjlw), and [emcee](https://emcee.readthedocs.io/en/stable/). The documentation for Eryn can be found here: [mikekatz04.github.io/Eryn](https://mikekatz04.github.io/Eryn). You will find the code on Github: [github.com/mikekatz04/Eryn](https://github.com/mikekatz04/Eryn).
6
+
7
+ ## Getting Started
8
+
9
+ Below is a quick set of instructions to get you started with `eryn`.
10
+
11
+ ```
12
+ pip install eryn
13
+ ```
14
+ To import eryn:
15
+
16
+ ```
17
+ from eryn.ensemble import EnsembleSampler
18
+ ```
19
+
20
+ See [examples notebook](https://github.com/mikekatz04/Eryn/blob/main/examples/Eryn_tutorial.ipynb) for more info. You can also navigate the [Documentation](https://mikekatz04.github.io/Eryn/html/index.html) pages.
21
+
22
+
23
+ ### Prerequisites
24
+
25
+ Eryn has only a few python-based dependencies: `tqdm`, `corner` for plotting, `numpy`, `matplotlib`.
26
+
27
+ ### Installing
28
+
29
+ If you are not planning to develop the code, you can just install the latest version with the pip installation technique given above. Otherwise, you can just clone the repo and run `pip install .` inside of the Eryn directory. To run tests on Eryn during development, you can run the following in the main Eryn directory:
30
+ ```
31
+ python -m unittest discover
32
+ ```
33
+
34
+
35
+ ## Running the Tests
36
+
37
+ In the main directory of the package run in the terminal:
38
+ ```
39
+ python -m unittest discover
40
+ ```
41
+
42
+
43
+ ## Contributing
44
+
45
+ Please read [CONTRIBUTING.md](CONTRIBUTING) for details on our code of conduct, and the process for submitting pull requests to us.
46
+
47
+ ## Versioning
48
+
49
+ We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/mikekatz04/Eryn/tags).
50
+
51
+ ## Citation
52
+
53
+ When using this package, please cite at minimum the following sources:
54
+
55
+ ```
56
+ @article{Karnesis:2023ras,
57
+ author = "Karnesis, Nikolaos and Katz, Michael L. and Korsakova, Natalia and Gair, Jonathan R. and Stergioulas, Nikolaos",
58
+ title = "{Eryn : A multi-purpose sampler for Bayesian inference}",
59
+ eprint = "2303.02164",
60
+ archivePrefix = "arXiv",
61
+ primaryClass = "astro-ph.IM",
62
+ month = "3",
63
+ year = "2023"
64
+ }
65
+
66
+ @software{michael_katz_2023_7705496,
67
+ author = {Michael Katz and
68
+ Nikolaos Karnesis and
69
+ Natalia Korsakova},
70
+ title = {mikekatz04/Eryn: first full release},
71
+ month = mar,
72
+ year = 2023,
73
+ publisher = {Zenodo},
74
+ version = {v1.0.0},
75
+ doi = {10.5281/zenodo.7705496},
76
+ url = {https://doi.org/10.5281/zenodo.7705496}
77
+ }
78
+
79
+ @ARTICLE{2013PASP..125..306F,
80
+ author = {{Foreman-Mackey}, Daniel and {Hogg}, David W. and {Lang}, Dustin and {Goodman}, Jonathan},
81
+ title = "{emcee: The MCMC Hammer}",
82
+ journal = {\pasp},
83
+ keywords = {Astrophysics - Instrumentation and Methods for Astrophysics, Physics - Computational Physics, Statistics - Computation},
84
+ year = 2013,
85
+ month = mar,
86
+ volume = {125},
87
+ number = {925},
88
+ pages = {306},
89
+ doi = {10.1086/670067},
90
+ archivePrefix = {arXiv},
91
+ eprint = {1202.3665},
92
+ primaryClass = {astro-ph.IM},
93
+ adsurl = {https://ui.adsabs.harvard.edu/abs/2013PASP..125..306F},
94
+ adsnote = {Provided by the SAO/NASA Astrophysics Data System}
95
+ }
96
+
97
+ ```
98
+
99
+ Depending on which proposals are used, you may be required to cite more sources. Please make sure you do this properly.
100
+
101
+ ## Authors
102
+
103
+ * **Michael Katz**
104
+ * Nikos Karnesis
105
+ * Natalia Korsakova
106
+ * Jonathan Gair
107
+
108
+ ### Contibutors
109
+
110
+ * Maybe you!
111
+
112
+ ## License
113
+
114
+ This project is licensed under the GNU License - see the [LICENSE.md](LICENSE) file for details.
115
+
116
+ ## Acknowledgments
117
+
118
+ * We wish to thank S. Babak, M. Le Jeune, S. Marsat, T. Littenberg, and N. Cornish for their useful comments and very fruitful discussions.
119
+ * N Stergioulas and N Karnesis acknowledge support from the Gr-PRODEX 2019 funding program (PEA 4000132310).
@@ -0,0 +1,87 @@
1
+ [build-system]
2
+ build-backend = "uv_build"
3
+
4
+ requires = [
5
+ "uv-build>=0.8.17,<0.9",
6
+ ]
7
+
8
+ [project]
9
+ name = "eryn" #@NAMESUFFIX@
10
+
11
+ version = "1.2.0"
12
+
13
+ description = "Eryn: an omni-MCMC sampling package."
14
+
15
+ readme = "README.md"
16
+
17
+ authors = [
18
+ { name = "Michael Katz", email = "mikekatz04@gmail.com" },
19
+ ]
20
+ requires-python = ">=3.9"
21
+
22
+ classifiers = [
23
+ "License :: OSI Approved :: Apache Software License",
24
+ "Natural Language :: English",
25
+ "Programming Language :: C++",
26
+ "Programming Language :: Cython",
27
+ "Programming Language :: Python :: 3 :: Only",
28
+ "Programming Language :: Python :: 3.9",
29
+ "Programming Language :: Python :: 3.10",
30
+ "Programming Language :: Python :: 3.11",
31
+ "Programming Language :: Python :: 3.12",
32
+ "Programming Language :: Python :: 3.13",
33
+ ]
34
+
35
+ dependencies = [
36
+ "exceptiongroup; python_version<'3.11'", # To access ExceptionGroup with Python 3.9 and 3.10
37
+ "h5py",
38
+ "jsonschema", # To validate content of file registry
39
+ "matplotlib",
40
+ "numpy",
41
+ "nvidia-ml-py", # To detect CUDA version if any
42
+ "platformdirs", # To locate config and data dir on all platforms
43
+ "pydantic", # To handle citations and references with advanced dataclasses
44
+ "pyyaml", # To read file registry
45
+ "requests", # To download files automatically
46
+ "rich", # To display downlaod progress bar
47
+ "scipy",
48
+ "tqdm",
49
+ "wrapt",
50
+ #@DEPS_CUPYCUDA@,
51
+ #@DEPS_ERYNCORE@,
52
+ ]
53
+
54
+ optional-dependencies.doc = [
55
+ "ipykernel",
56
+ "ipython",
57
+ "ipywidgets",
58
+ "myst-parser",
59
+ "nbsphinx",
60
+ "pypandoc",
61
+ "sphinx",
62
+ "sphinx-rtd-theme",
63
+ "sphinx-tippy",
64
+ "corner"
65
+ ]
66
+
67
+ optional-dependencies.testing = [
68
+ "matplotlib",
69
+ "corner",
70
+ "chainconsumer",
71
+ ]
72
+
73
+ [tool.pyproject-fmt]
74
+ max_supported_python = "3.13"
75
+
76
+ [tool.coverage]
77
+ paths.source = [
78
+ "src/",
79
+ "**/site-packages/",
80
+ ]
81
+
82
+ report.omit = [
83
+ "*/eryn/_version.py",
84
+ "*/eryn/tests/*.py",
85
+ "*/eryn/git_version.py",
86
+ "*/eryn_backend_*/git_version.py",
87
+ ]
@@ -0,0 +1,51 @@
1
+ # Add subdirectories which contain compiled sources
2
+
3
+ # Handle Git Metadata
4
+ get_target_property(_ERYN_WITH_CPU eryn WITH_CPU)
5
+ get_target_property(_ERYN_WITH_GPU eryn WITH_GPU)
6
+
7
+ message(CHECK_START "Building eryn.git_version metadata")
8
+ message(CHECK_START "Find Git executable")
9
+ find_package(Git)
10
+ if(Git_FOUND)
11
+ message(CHECK_PASS "found")
12
+ message(CHECK_START "Checking if in Git worktree")
13
+ execute_process(
14
+ COMMAND ${GIT_EXECUTABLE} rev-parse --is-inside-work-tree
15
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
16
+ OUTPUT_QUIET ERROR_QUIET
17
+ RESULT_VARIABLE ERYN_GIT_IN_WORKTREE_CODE)
18
+ if(ERYN_GIT_IN_WORKTREE_CODE EQUAL "0")
19
+ message(CHECK_PASS "yes")
20
+
21
+ execute_process(
22
+ COMMAND ${GIT_EXECUTABLE} log -1 --format=%H
23
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
24
+ OUTPUT_VARIABLE ERYN_GIT_COMMIT_ID
25
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
26
+ execute_process(
27
+ COMMAND ${GIT_EXECUTABLE} log -1 --format=%h
28
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
29
+ OUTPUT_VARIABLE ERYN_GIT_COMMIT_SHORT_ID
30
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
31
+
32
+ configure_file(git_version.py.in git_version.py @ONLY)
33
+
34
+ if(_ERYN_WITH_CPU)
35
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/git_version.py DESTINATION eryn)
36
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/git_version.py
37
+ DESTINATION eryn_backend_cpu)
38
+ endif()
39
+ if(_ERYN_WITH_GPU)
40
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/git_version.py
41
+ DESTINATION eryn_backend_cuda${CUDAToolkit_VERSION_MAJOR}x)
42
+ endif()
43
+
44
+ message(CHECK_PASS "done")
45
+ else()
46
+ message(CHECK_FAIL "no")
47
+ endif()
48
+ else()
49
+ message(CHECK_FAIL "not found")
50
+ message(CHECK_FAIL "eryn.git_version will not be available")
51
+ endif()
@@ -0,0 +1,35 @@
1
+ """GPU Backend Tools."""
2
+
3
+ # ruff: noqa: E402
4
+ try:
5
+ from eryn._version import ( # pylint: disable=E0401,E0611
6
+ __version__,
7
+ __version_tuple__,
8
+ )
9
+
10
+ except ModuleNotFoundError:
11
+ from importlib.metadata import PackageNotFoundError, version # pragma: no cover
12
+
13
+ try:
14
+ __version__ = version(__name__)
15
+ __version_tuple__ = tuple(__version__.split("."))
16
+ except PackageNotFoundError: # pragma: no cover
17
+ __version__ = "unknown"
18
+ __version_tuple__ = (0, 0, 0, "unknown")
19
+ finally:
20
+ del version, PackageNotFoundError
21
+
22
+ _is_editable: bool
23
+ try:
24
+ from . import _editable
25
+
26
+ _is_editable = True
27
+ del _editable
28
+ except (ModuleNotFoundError, ImportError):
29
+ _is_editable = False
30
+
31
+ __all__ = [
32
+ "__version__",
33
+ "__version_tuple__",
34
+ "_is_editable",
35
+ ]
@@ -0,0 +1,20 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ from .backend import Backend
4
+
5
+ from .hdfbackend import HDFBackend, TempHDFBackend
6
+
7
+ __all__ = ["Backend", "HDFBackend", "TempHDFBackend", "get_test_backends"]
8
+
9
+
10
+ def get_test_backends():
11
+ backends = [Backend]
12
+
13
+ try:
14
+ import h5py # NOQA
15
+ except ImportError:
16
+ pass
17
+ else:
18
+ backends.append(TempHDFBackend)
19
+
20
+ return backends