CUQIpy 0.5.0.post0.dev27__tar.gz → 0.5.0.post0.dev34__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.

Potentially problematic release.


This version of CUQIpy might be problematic. Click here for more details.

Files changed (96) hide show
  1. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/CUQIpy.egg-info/PKG-INFO +63 -39
  2. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/PKG-INFO +63 -39
  3. CUQIpy-0.5.0.post0.dev34/README.md +99 -0
  4. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/_version.py +3 -3
  5. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/data/_data.py +4 -2
  6. CUQIpy-0.5.0.post0.dev27/README.md +0 -75
  7. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/CUQIpy.egg-info/SOURCES.txt +0 -0
  8. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/CUQIpy.egg-info/dependency_links.txt +0 -0
  9. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/CUQIpy.egg-info/requires.txt +0 -0
  10. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/CUQIpy.egg-info/top_level.txt +0 -0
  11. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/LICENSE +0 -0
  12. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/__init__.py +0 -0
  13. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/_messages.py +0 -0
  14. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/array/__init__.py +0 -0
  15. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/array/_array.py +0 -0
  16. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/config.py +0 -0
  17. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/data/__init__.py +0 -0
  18. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/data/astronaut.npz +0 -0
  19. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/data/camera.npz +0 -0
  20. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/data/cat.npz +0 -0
  21. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/data/satellite.mat +0 -0
  22. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/density/__init__.py +0 -0
  23. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/density/_density.py +0 -0
  24. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/diagnostics.py +0 -0
  25. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/distribution/__init__.py +0 -0
  26. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/distribution/_beta.py +0 -0
  27. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/distribution/_cauchy.py +0 -0
  28. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/distribution/_cmrf.py +0 -0
  29. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/distribution/_custom.py +0 -0
  30. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/distribution/_distribution.py +0 -0
  31. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/distribution/_gamma.py +0 -0
  32. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/distribution/_gaussian.py +0 -0
  33. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/distribution/_gmrf.py +0 -0
  34. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/distribution/_inverse_gamma.py +0 -0
  35. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/distribution/_joint_distribution.py +0 -0
  36. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/distribution/_laplace.py +0 -0
  37. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/distribution/_lmrf.py +0 -0
  38. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/distribution/_lognormal.py +0 -0
  39. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/distribution/_normal.py +0 -0
  40. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/distribution/_posterior.py +0 -0
  41. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/distribution/_uniform.py +0 -0
  42. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/geometry/__init__.py +0 -0
  43. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/geometry/_geometry.py +0 -0
  44. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/likelihood/__init__.py +0 -0
  45. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/likelihood/_likelihood.py +0 -0
  46. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/model/__init__.py +0 -0
  47. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/model/_model.py +0 -0
  48. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/operator/__init__.py +0 -0
  49. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/operator/_operator.py +0 -0
  50. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/pde/__init__.py +0 -0
  51. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/pde/_pde.py +0 -0
  52. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/problem/__init__.py +0 -0
  53. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/problem/_problem.py +0 -0
  54. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/sampler/__init__.py +0 -0
  55. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/sampler/_conjugate.py +0 -0
  56. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/sampler/_conjugate_approx.py +0 -0
  57. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/sampler/_cwmh.py +0 -0
  58. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/sampler/_gibbs.py +0 -0
  59. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/sampler/_hmc.py +0 -0
  60. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/sampler/_langevin_algorithm.py +0 -0
  61. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/sampler/_laplace_approximation.py +0 -0
  62. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/sampler/_mh.py +0 -0
  63. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/sampler/_pcn.py +0 -0
  64. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/sampler/_rto.py +0 -0
  65. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/sampler/_sampler.py +0 -0
  66. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/samples/__init__.py +0 -0
  67. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/samples/_samples.py +0 -0
  68. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/solver/__init__.py +0 -0
  69. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/solver/_solver.py +0 -0
  70. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/testproblem/__init__.py +0 -0
  71. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/testproblem/_testproblem.py +0 -0
  72. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/utilities/__init__.py +0 -0
  73. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/utilities/_get_python_variable_name.py +0 -0
  74. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/cuqi/utilities/_utilities.py +0 -0
  75. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/pyproject.toml +0 -0
  76. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/requirements.txt +0 -0
  77. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/setup.cfg +0 -0
  78. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/setup.py +0 -0
  79. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/tests/test_MRFs.py +0 -0
  80. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/tests/test_abstract_distribution_density.py +0 -0
  81. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/tests/test_bayesian_inversion.py +0 -0
  82. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/tests/test_density.py +0 -0
  83. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/tests/test_distribution.py +0 -0
  84. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/tests/test_distributions_shape.py +0 -0
  85. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/tests/test_geometry.py +0 -0
  86. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/tests/test_joint_distribution.py +0 -0
  87. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/tests/test_likelihood.py +0 -0
  88. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/tests/test_model.py +0 -0
  89. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/tests/test_pde.py +0 -0
  90. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/tests/test_posterior.py +0 -0
  91. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/tests/test_problem.py +0 -0
  92. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/tests/test_sampler.py +0 -0
  93. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/tests/test_samples.py +0 -0
  94. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/tests/test_solver.py +0 -0
  95. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/tests/test_testproblem.py +0 -0
  96. {CUQIpy-0.5.0.post0.dev27 → CUQIpy-0.5.0.post0.dev34}/tests/test_utilities.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: CUQIpy
3
- Version: 0.5.0.post0.dev27
3
+ Version: 0.5.0.post0.dev34
4
4
  Summary: Computational Uncertainty Quantification for Inverse problems in Python
5
5
  Maintainer-email: "Nicolai A. B. Riis" <nabr@dtu.dk>, "Jakob S. Jørgensen" <jakj@dtu.dk>, "Amal M. Alghamdi" <amaal@dtu.dk>
6
6
  License: Apache License
@@ -213,70 +213,94 @@ Requires-Dist: arviz
213
213
 
214
214
  [![pytest](https://github.com/CUQI-DTU/CUQIpy/actions/workflows/tests.yml/badge.svg)](https://github.com/CUQI-DTU/CUQIpy/actions/workflows/tests.yml)
215
215
  [![docs](https://github.com/CUQI-DTU/CUQIpy/actions/workflows/docs.yml/badge.svg)](https://cuqi-dtu.github.io/CUQIpy/)
216
+ [![PyPI](https://github.com/CUQI-DTU/CUQIpy/actions/workflows/publish_pypi.yml/badge.svg)](https://pypi.org/project/CUQIpy/#history)
216
217
 
217
- Computational Uncertainty Quantification for Inverse Problems in python (CUQIpy) is a python package for modeling and solving inverse problems in a Bayesian inference framework. CUQIpy provides a simple high-level interface to perform UQ analysis of inverse problems, while still allowing full control of the models and methods. The package comes equipped with a number of predefined distributions, samplers, models and test problems and is built to be easily further extended when needed.
218
+ **CUQIpy** stands for Computational Uncertainty Quantification for Inverse Problems in python. It's a robust Python package designed for modeling and solving inverse problems using Bayesian inference. Here's what it brings to the table:
218
219
 
219
- You can find the full CUQIpy documentation [here](https://cuqi-dtu.github.io/CUQIpy/).
220
+ - A straightforward high-level interface for UQ analysis.
221
+ - Complete control over the models and methods.
222
+ - An array of predefined distributions, samplers, models, and test problems.
223
+ - Easy extendability for your unique needs.
220
224
 
221
- This software package is part of the [CUQI project](https://www.compute.dtu.dk/english/cuqi) funded by [the Villum Foundation.](https://veluxfoundations.dk/en/forskning/teknisk-og-naturvidenskabelig-forskning)
225
+ CUQIpy is part of the [CUQI project](https://www.compute.dtu.dk/english/cuqi) supported by the [Villum Foundation.](https://veluxfoundations.dk/en/forskning/teknisk-og-naturvidenskabelig-forskning)
222
226
 
223
- ## Quickstart
227
+ ## 📚 Resources
228
+
229
+ - **Documentation:** [CUQIpy website](https://cuqi-dtu.github.io/CUQIpy/)
230
+
231
+ - **Papers:** CUQIpy on ArXiv - [Part I](https://arxiv.org/abs/2305.16949) & [Part II](https://arxiv.org/abs/2305.16951)
232
+
233
+ - **Training:** [Demo & training notebooks](https://github.com/CUQI-DTU/CUQIpy-demos)
234
+
235
+
236
+ ## 🚀 Quickstart
224
237
  Install CUQIpy using pip:
225
238
  ```{r, engine='bash', count_lines}
226
239
  pip install cuqipy
227
240
  ```
228
241
  For more detailed instructions, see the [Getting Started](https://cuqi-dtu.github.io/CUQIpy/user/getting_started.html) guide.
229
242
 
230
- ## Quick Example - UQ in 5 steps
231
- Image deconvolution with uncertainty quantification
243
+ ## 🧪 Quick Example - UQ in a few lines of code
244
+ Experience the simplicity and power of CUQIpy with this Image deconvolution example. Getting started with UQ takes just a few lines of code:
232
245
  ```python
233
246
  # Imports
234
- import numpy as np
235
247
  import matplotlib.pyplot as plt
236
248
  from cuqi.testproblem import Deconvolution2D
237
- from cuqi.data import grains
238
- from cuqi.distribution import LMRF, Gaussian
249
+ from cuqi.distribution import Gaussian, LMRF, Gamma
239
250
  from cuqi.problem import BayesianProblem
240
251
 
241
- # Step 1: Model and data, y = Ax
242
- A, y_data, info = Deconvolution2D.get_components(dim=128, phantom=grains())
243
-
244
- # Step 2: Prior, x ~ LMRF(0,0.01)
245
- x = LMRF(location=0,
246
- scale=0.01,
247
- bc_type='neumann',
248
- geometry = A.domain_geometry)
252
+ # Step 1: Set up forward model and data, y = Ax
253
+ A, y_data, info = Deconvolution2D.get_components(dim=256, phantom="cookie")
249
254
 
250
- # Step 3: Likelihood, y ~ N(Ax, 0.0036^2)
251
- y = Gaussian(mean=A@x, cov=0.0036**2)
255
+ # Step 2: Define distributions for parameters
256
+ d = Gamma(1, 1e-4)
257
+ s = Gamma(1, 1e-4)
258
+ x = LMRF(0, lambda d: 1/d, geometry=A.domain_geometry)
259
+ y = Gaussian(A@x, lambda s: 1/s)
252
260
 
253
- # Step 4: Set up Bayesian problem and sample posterior
254
- BP = BayesianProblem(y, x).set_data(y=y_data)
261
+ # Step 3: Combine into Bayesian Problem and sample posterior
262
+ BP = BayesianProblem(y, x, d, s)
263
+ BP.set_data(y=y_data)
255
264
  samples = BP.sample_posterior(200)
256
265
 
257
- # Step 5: Analysis
258
- info.exactSolution.plot(); plt.title("Exact solution")
259
- y_data.plot(); plt.title("Data")
260
- samples.plot_mean(); plt.title("Posterior mean")
261
- samples.plot_std(); plt.title("Posterior standard deviation")
266
+ # Step 4: Analyze results
267
+ info.exactSolution.plot(); plt.title("Sharp image (exact solution)")
268
+ y_data.plot(); plt.title("Blurred and noisy image (data)")
269
+ samples["x"].plot_mean(); plt.title("Estimated image (posterior mean)")
270
+ samples["x"].plot_std(); plt.title("Uncertainty (posterior standard deviation)")
271
+ samples["s"].plot_trace(); plt.suptitle("Noise level (posterior trace)")
272
+ samples["d"].plot_trace(); plt.suptitle("Regularization parameter (posterior trace)")
262
273
  ```
263
274
 
264
275
  <p float="left">
265
- <img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_exact_sol.png" alt="Exact solution" width="330">
266
- <img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_data.png" alt="Data" width="330">
267
- <img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_post_mean.png" alt="Posterior mean" width="330">
268
- <img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_post_std.png" alt="Posterior standard deviation" width="330">
276
+ <img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_exact_sol.png" alt="Sharp image (exact solution)" width="330">
277
+ <img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_data.png" alt="Blurred and noisy image (data)" width="330">
278
+ <img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_post_mean.png" alt="Estimated image (posterior mean)" width="330">
279
+ <img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_post_std.png" alt="Uncertainty (posterior standard deviation)" width="330">
280
+ <img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_noise_level.png" alt="Noise level (posterior trace)" width="660">
281
+ <img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_regularization_parameter.png" alt="Regularization parameter (posterior trace)" width="660">
269
282
  </p>
270
283
 
271
- ## Plugins
272
- CUQIpy can be extended with additional functionality by installing optional plugins. These can be found at
273
- [CUQI-DTU](https://github.com/CUQI-DTU?q=CUQIpy-).
284
+ ## 🔌 Plugins
285
+ CUQIpy can be extended with additional functionality by installing optional plugins. We currently offer the following plugins:
274
286
 
275
- ## Contributing
287
+ - [CUQIpy-CIL](https://github.com/CUQI-DTU/CUQIpy-CIL) A plugin for the Core Imaging Library [(CIL)](https://ccpi.ac.uk/cil/) providing access to forward models for X-ray computed tomography.
288
+
289
+ - [CUQIpy-FEniCS](https://github.com/CUQI-DTU/CUQIpy-FEniCS): A plugin providing access to the finite element modelling tool [FEniCS](https://fenicsproject.org), which is used for solving PDE-based inverse problems.
290
+
291
+ - [CUQIpy-PyTorch](https://github.com/CUQI-DTU/CUQIpy-PyTorch): A plugin providing access to the automatic differentiation framework of [PyTorch](https://pytorch.org) within CUQIpy. It allows gradient-based sampling methods without manually providing derivative information of distributions and forward models.
292
+
293
+ ## 🤝 Contributing
276
294
  We welcome contributions to CUQIpy. Please see our [contributing guidelines](https://cuqi-dtu.github.io/CUQIpy/dev/index.html) for more information.
277
295
 
278
- ## Contributors
296
+ ## 💻 Developers
297
+
298
+ [Nicolai André Brogaard Riis](https://github.com/nabriis)
299
+ [Amal Mohammed A Alghamdi](https://github.com/amal-ghamdi)
300
+ [Chao Zhang](https://github.com/chaozg)
301
+ [Jakob Sauer Jørgensen](https://github.com/jakobsj)
302
+
303
+ ## 🌟 Contributors
279
304
 
280
- See the list of
281
- [contributors](https://github.com/CUQI-DTU/CUQIpy/graphs/contributors)
282
- who participated in this project.
305
+ A big shoutout to our passionate team! Discover the talented individuals behind CUQIpy
306
+ [here](https://github.com/CUQI-DTU/CUQIpy/graphs/contributors).
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: CUQIpy
3
- Version: 0.5.0.post0.dev27
3
+ Version: 0.5.0.post0.dev34
4
4
  Summary: Computational Uncertainty Quantification for Inverse problems in Python
5
5
  Maintainer-email: "Nicolai A. B. Riis" <nabr@dtu.dk>, "Jakob S. Jørgensen" <jakj@dtu.dk>, "Amal M. Alghamdi" <amaal@dtu.dk>
6
6
  License: Apache License
@@ -213,70 +213,94 @@ Requires-Dist: arviz
213
213
 
214
214
  [![pytest](https://github.com/CUQI-DTU/CUQIpy/actions/workflows/tests.yml/badge.svg)](https://github.com/CUQI-DTU/CUQIpy/actions/workflows/tests.yml)
215
215
  [![docs](https://github.com/CUQI-DTU/CUQIpy/actions/workflows/docs.yml/badge.svg)](https://cuqi-dtu.github.io/CUQIpy/)
216
+ [![PyPI](https://github.com/CUQI-DTU/CUQIpy/actions/workflows/publish_pypi.yml/badge.svg)](https://pypi.org/project/CUQIpy/#history)
216
217
 
217
- Computational Uncertainty Quantification for Inverse Problems in python (CUQIpy) is a python package for modeling and solving inverse problems in a Bayesian inference framework. CUQIpy provides a simple high-level interface to perform UQ analysis of inverse problems, while still allowing full control of the models and methods. The package comes equipped with a number of predefined distributions, samplers, models and test problems and is built to be easily further extended when needed.
218
+ **CUQIpy** stands for Computational Uncertainty Quantification for Inverse Problems in python. It's a robust Python package designed for modeling and solving inverse problems using Bayesian inference. Here's what it brings to the table:
218
219
 
219
- You can find the full CUQIpy documentation [here](https://cuqi-dtu.github.io/CUQIpy/).
220
+ - A straightforward high-level interface for UQ analysis.
221
+ - Complete control over the models and methods.
222
+ - An array of predefined distributions, samplers, models, and test problems.
223
+ - Easy extendability for your unique needs.
220
224
 
221
- This software package is part of the [CUQI project](https://www.compute.dtu.dk/english/cuqi) funded by [the Villum Foundation.](https://veluxfoundations.dk/en/forskning/teknisk-og-naturvidenskabelig-forskning)
225
+ CUQIpy is part of the [CUQI project](https://www.compute.dtu.dk/english/cuqi) supported by the [Villum Foundation.](https://veluxfoundations.dk/en/forskning/teknisk-og-naturvidenskabelig-forskning)
222
226
 
223
- ## Quickstart
227
+ ## 📚 Resources
228
+
229
+ - **Documentation:** [CUQIpy website](https://cuqi-dtu.github.io/CUQIpy/)
230
+
231
+ - **Papers:** CUQIpy on ArXiv - [Part I](https://arxiv.org/abs/2305.16949) & [Part II](https://arxiv.org/abs/2305.16951)
232
+
233
+ - **Training:** [Demo & training notebooks](https://github.com/CUQI-DTU/CUQIpy-demos)
234
+
235
+
236
+ ## 🚀 Quickstart
224
237
  Install CUQIpy using pip:
225
238
  ```{r, engine='bash', count_lines}
226
239
  pip install cuqipy
227
240
  ```
228
241
  For more detailed instructions, see the [Getting Started](https://cuqi-dtu.github.io/CUQIpy/user/getting_started.html) guide.
229
242
 
230
- ## Quick Example - UQ in 5 steps
231
- Image deconvolution with uncertainty quantification
243
+ ## 🧪 Quick Example - UQ in a few lines of code
244
+ Experience the simplicity and power of CUQIpy with this Image deconvolution example. Getting started with UQ takes just a few lines of code:
232
245
  ```python
233
246
  # Imports
234
- import numpy as np
235
247
  import matplotlib.pyplot as plt
236
248
  from cuqi.testproblem import Deconvolution2D
237
- from cuqi.data import grains
238
- from cuqi.distribution import LMRF, Gaussian
249
+ from cuqi.distribution import Gaussian, LMRF, Gamma
239
250
  from cuqi.problem import BayesianProblem
240
251
 
241
- # Step 1: Model and data, y = Ax
242
- A, y_data, info = Deconvolution2D.get_components(dim=128, phantom=grains())
243
-
244
- # Step 2: Prior, x ~ LMRF(0,0.01)
245
- x = LMRF(location=0,
246
- scale=0.01,
247
- bc_type='neumann',
248
- geometry = A.domain_geometry)
252
+ # Step 1: Set up forward model and data, y = Ax
253
+ A, y_data, info = Deconvolution2D.get_components(dim=256, phantom="cookie")
249
254
 
250
- # Step 3: Likelihood, y ~ N(Ax, 0.0036^2)
251
- y = Gaussian(mean=A@x, cov=0.0036**2)
255
+ # Step 2: Define distributions for parameters
256
+ d = Gamma(1, 1e-4)
257
+ s = Gamma(1, 1e-4)
258
+ x = LMRF(0, lambda d: 1/d, geometry=A.domain_geometry)
259
+ y = Gaussian(A@x, lambda s: 1/s)
252
260
 
253
- # Step 4: Set up Bayesian problem and sample posterior
254
- BP = BayesianProblem(y, x).set_data(y=y_data)
261
+ # Step 3: Combine into Bayesian Problem and sample posterior
262
+ BP = BayesianProblem(y, x, d, s)
263
+ BP.set_data(y=y_data)
255
264
  samples = BP.sample_posterior(200)
256
265
 
257
- # Step 5: Analysis
258
- info.exactSolution.plot(); plt.title("Exact solution")
259
- y_data.plot(); plt.title("Data")
260
- samples.plot_mean(); plt.title("Posterior mean")
261
- samples.plot_std(); plt.title("Posterior standard deviation")
266
+ # Step 4: Analyze results
267
+ info.exactSolution.plot(); plt.title("Sharp image (exact solution)")
268
+ y_data.plot(); plt.title("Blurred and noisy image (data)")
269
+ samples["x"].plot_mean(); plt.title("Estimated image (posterior mean)")
270
+ samples["x"].plot_std(); plt.title("Uncertainty (posterior standard deviation)")
271
+ samples["s"].plot_trace(); plt.suptitle("Noise level (posterior trace)")
272
+ samples["d"].plot_trace(); plt.suptitle("Regularization parameter (posterior trace)")
262
273
  ```
263
274
 
264
275
  <p float="left">
265
- <img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_exact_sol.png" alt="Exact solution" width="330">
266
- <img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_data.png" alt="Data" width="330">
267
- <img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_post_mean.png" alt="Posterior mean" width="330">
268
- <img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_post_std.png" alt="Posterior standard deviation" width="330">
276
+ <img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_exact_sol.png" alt="Sharp image (exact solution)" width="330">
277
+ <img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_data.png" alt="Blurred and noisy image (data)" width="330">
278
+ <img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_post_mean.png" alt="Estimated image (posterior mean)" width="330">
279
+ <img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_post_std.png" alt="Uncertainty (posterior standard deviation)" width="330">
280
+ <img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_noise_level.png" alt="Noise level (posterior trace)" width="660">
281
+ <img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_regularization_parameter.png" alt="Regularization parameter (posterior trace)" width="660">
269
282
  </p>
270
283
 
271
- ## Plugins
272
- CUQIpy can be extended with additional functionality by installing optional plugins. These can be found at
273
- [CUQI-DTU](https://github.com/CUQI-DTU?q=CUQIpy-).
284
+ ## 🔌 Plugins
285
+ CUQIpy can be extended with additional functionality by installing optional plugins. We currently offer the following plugins:
274
286
 
275
- ## Contributing
287
+ - [CUQIpy-CIL](https://github.com/CUQI-DTU/CUQIpy-CIL) A plugin for the Core Imaging Library [(CIL)](https://ccpi.ac.uk/cil/) providing access to forward models for X-ray computed tomography.
288
+
289
+ - [CUQIpy-FEniCS](https://github.com/CUQI-DTU/CUQIpy-FEniCS): A plugin providing access to the finite element modelling tool [FEniCS](https://fenicsproject.org), which is used for solving PDE-based inverse problems.
290
+
291
+ - [CUQIpy-PyTorch](https://github.com/CUQI-DTU/CUQIpy-PyTorch): A plugin providing access to the automatic differentiation framework of [PyTorch](https://pytorch.org) within CUQIpy. It allows gradient-based sampling methods without manually providing derivative information of distributions and forward models.
292
+
293
+ ## 🤝 Contributing
276
294
  We welcome contributions to CUQIpy. Please see our [contributing guidelines](https://cuqi-dtu.github.io/CUQIpy/dev/index.html) for more information.
277
295
 
278
- ## Contributors
296
+ ## 💻 Developers
297
+
298
+ [Nicolai André Brogaard Riis](https://github.com/nabriis)
299
+ [Amal Mohammed A Alghamdi](https://github.com/amal-ghamdi)
300
+ [Chao Zhang](https://github.com/chaozg)
301
+ [Jakob Sauer Jørgensen](https://github.com/jakobsj)
302
+
303
+ ## 🌟 Contributors
279
304
 
280
- See the list of
281
- [contributors](https://github.com/CUQI-DTU/CUQIpy/graphs/contributors)
282
- who participated in this project.
305
+ A big shoutout to our passionate team! Discover the talented individuals behind CUQIpy
306
+ [here](https://github.com/CUQI-DTU/CUQIpy/graphs/contributors).
@@ -0,0 +1,99 @@
1
+ <div align="center">
2
+ <img src="https://cuqi-dtu.github.io/CUQIpy/_static/logo.png" alt="CUQIpy logo" width="250"/>
3
+ </div>
4
+
5
+ # Computational Uncertainty Quantification for Inverse Problems in python
6
+
7
+ [![pytest](https://github.com/CUQI-DTU/CUQIpy/actions/workflows/tests.yml/badge.svg)](https://github.com/CUQI-DTU/CUQIpy/actions/workflows/tests.yml)
8
+ [![docs](https://github.com/CUQI-DTU/CUQIpy/actions/workflows/docs.yml/badge.svg)](https://cuqi-dtu.github.io/CUQIpy/)
9
+ [![PyPI](https://github.com/CUQI-DTU/CUQIpy/actions/workflows/publish_pypi.yml/badge.svg)](https://pypi.org/project/CUQIpy/#history)
10
+
11
+ **CUQIpy** stands for Computational Uncertainty Quantification for Inverse Problems in python. It's a robust Python package designed for modeling and solving inverse problems using Bayesian inference. Here's what it brings to the table:
12
+
13
+ - A straightforward high-level interface for UQ analysis.
14
+ - Complete control over the models and methods.
15
+ - An array of predefined distributions, samplers, models, and test problems.
16
+ - Easy extendability for your unique needs.
17
+
18
+ CUQIpy is part of the [CUQI project](https://www.compute.dtu.dk/english/cuqi) supported by the [Villum Foundation.](https://veluxfoundations.dk/en/forskning/teknisk-og-naturvidenskabelig-forskning)
19
+
20
+ ## 📚 Resources
21
+
22
+ - **Documentation:** [CUQIpy website](https://cuqi-dtu.github.io/CUQIpy/)
23
+
24
+ - **Papers:** CUQIpy on ArXiv - [Part I](https://arxiv.org/abs/2305.16949) & [Part II](https://arxiv.org/abs/2305.16951)
25
+
26
+ - **Training:** [Demo & training notebooks](https://github.com/CUQI-DTU/CUQIpy-demos)
27
+
28
+
29
+ ## 🚀 Quickstart
30
+ Install CUQIpy using pip:
31
+ ```{r, engine='bash', count_lines}
32
+ pip install cuqipy
33
+ ```
34
+ For more detailed instructions, see the [Getting Started](https://cuqi-dtu.github.io/CUQIpy/user/getting_started.html) guide.
35
+
36
+ ## 🧪 Quick Example - UQ in a few lines of code
37
+ Experience the simplicity and power of CUQIpy with this Image deconvolution example. Getting started with UQ takes just a few lines of code:
38
+ ```python
39
+ # Imports
40
+ import matplotlib.pyplot as plt
41
+ from cuqi.testproblem import Deconvolution2D
42
+ from cuqi.distribution import Gaussian, LMRF, Gamma
43
+ from cuqi.problem import BayesianProblem
44
+
45
+ # Step 1: Set up forward model and data, y = Ax
46
+ A, y_data, info = Deconvolution2D.get_components(dim=256, phantom="cookie")
47
+
48
+ # Step 2: Define distributions for parameters
49
+ d = Gamma(1, 1e-4)
50
+ s = Gamma(1, 1e-4)
51
+ x = LMRF(0, lambda d: 1/d, geometry=A.domain_geometry)
52
+ y = Gaussian(A@x, lambda s: 1/s)
53
+
54
+ # Step 3: Combine into Bayesian Problem and sample posterior
55
+ BP = BayesianProblem(y, x, d, s)
56
+ BP.set_data(y=y_data)
57
+ samples = BP.sample_posterior(200)
58
+
59
+ # Step 4: Analyze results
60
+ info.exactSolution.plot(); plt.title("Sharp image (exact solution)")
61
+ y_data.plot(); plt.title("Blurred and noisy image (data)")
62
+ samples["x"].plot_mean(); plt.title("Estimated image (posterior mean)")
63
+ samples["x"].plot_std(); plt.title("Uncertainty (posterior standard deviation)")
64
+ samples["s"].plot_trace(); plt.suptitle("Noise level (posterior trace)")
65
+ samples["d"].plot_trace(); plt.suptitle("Regularization parameter (posterior trace)")
66
+ ```
67
+
68
+ <p float="left">
69
+ <img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_exact_sol.png" alt="Sharp image (exact solution)" width="330">
70
+ <img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_data.png" alt="Blurred and noisy image (data)" width="330">
71
+ <img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_post_mean.png" alt="Estimated image (posterior mean)" width="330">
72
+ <img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_post_std.png" alt="Uncertainty (posterior standard deviation)" width="330">
73
+ <img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_noise_level.png" alt="Noise level (posterior trace)" width="660">
74
+ <img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_regularization_parameter.png" alt="Regularization parameter (posterior trace)" width="660">
75
+ </p>
76
+
77
+ ## 🔌 Plugins
78
+ CUQIpy can be extended with additional functionality by installing optional plugins. We currently offer the following plugins:
79
+
80
+ - [CUQIpy-CIL](https://github.com/CUQI-DTU/CUQIpy-CIL) A plugin for the Core Imaging Library [(CIL)](https://ccpi.ac.uk/cil/) providing access to forward models for X-ray computed tomography.
81
+
82
+ - [CUQIpy-FEniCS](https://github.com/CUQI-DTU/CUQIpy-FEniCS): A plugin providing access to the finite element modelling tool [FEniCS](https://fenicsproject.org), which is used for solving PDE-based inverse problems.
83
+
84
+ - [CUQIpy-PyTorch](https://github.com/CUQI-DTU/CUQIpy-PyTorch): A plugin providing access to the automatic differentiation framework of [PyTorch](https://pytorch.org) within CUQIpy. It allows gradient-based sampling methods without manually providing derivative information of distributions and forward models.
85
+
86
+ ## 🤝 Contributing
87
+ We welcome contributions to CUQIpy. Please see our [contributing guidelines](https://cuqi-dtu.github.io/CUQIpy/dev/index.html) for more information.
88
+
89
+ ## 💻 Developers
90
+
91
+ [Nicolai André Brogaard Riis](https://github.com/nabriis)
92
+ [Amal Mohammed A Alghamdi](https://github.com/amal-ghamdi)
93
+ [Chao Zhang](https://github.com/chaozg)
94
+ [Jakob Sauer Jørgensen](https://github.com/jakobsj)
95
+
96
+ ## 🌟 Contributors
97
+
98
+ A big shoutout to our passionate team! Discover the talented individuals behind CUQIpy
99
+ [here](https://github.com/CUQI-DTU/CUQIpy/graphs/contributors).
@@ -8,11 +8,11 @@ import json
8
8
 
9
9
  version_json = '''
10
10
  {
11
- "date": "2023-10-04T08:52:20+0200",
11
+ "date": "2023-10-06T17:16:50+0200",
12
12
  "dirty": false,
13
13
  "error": null,
14
- "full-revisionid": "716b4d41cefac22fd6f6604b31714a21b72bad81",
15
- "version": "0.5.0.post0.dev27"
14
+ "full-revisionid": "900bab604f6c0683ac7ffd1f2a912296b85e5467",
15
+ "version": "0.5.0.post0.dev34"
16
16
  }
17
17
  ''' # END VERSION_JSON
18
18
 
@@ -350,11 +350,13 @@ def cookie(size=128, grayscale=True):
350
350
  # Convert to grayscale
351
351
  if grayscale:
352
352
  cookie = rgb2gray(cookie)
353
- cookie[cookie < 0.05] = 0 # Make background completely black
354
-
353
+
355
354
  # Resize
356
355
  cookie = imresize(cookie, size)
357
356
 
357
+ if grayscale:
358
+ cookie[cookie < 0.05] = 0 # Make background completely black
359
+
358
360
  return cookie
359
361
 
360
362
  def rgb2gray(img):
@@ -1,75 +0,0 @@
1
- <div align="center">
2
- <img src="https://cuqi-dtu.github.io/CUQIpy/_static/logo.png" alt="CUQIpy logo" width="250"/>
3
- </div>
4
-
5
- # Computational Uncertainty Quantification for Inverse Problems in python
6
-
7
- [![pytest](https://github.com/CUQI-DTU/CUQIpy/actions/workflows/tests.yml/badge.svg)](https://github.com/CUQI-DTU/CUQIpy/actions/workflows/tests.yml)
8
- [![docs](https://github.com/CUQI-DTU/CUQIpy/actions/workflows/docs.yml/badge.svg)](https://cuqi-dtu.github.io/CUQIpy/)
9
-
10
- Computational Uncertainty Quantification for Inverse Problems in python (CUQIpy) is a python package for modeling and solving inverse problems in a Bayesian inference framework. CUQIpy provides a simple high-level interface to perform UQ analysis of inverse problems, while still allowing full control of the models and methods. The package comes equipped with a number of predefined distributions, samplers, models and test problems and is built to be easily further extended when needed.
11
-
12
- You can find the full CUQIpy documentation [here](https://cuqi-dtu.github.io/CUQIpy/).
13
-
14
- This software package is part of the [CUQI project](https://www.compute.dtu.dk/english/cuqi) funded by [the Villum Foundation.](https://veluxfoundations.dk/en/forskning/teknisk-og-naturvidenskabelig-forskning)
15
-
16
- ## Quickstart
17
- Install CUQIpy using pip:
18
- ```{r, engine='bash', count_lines}
19
- pip install cuqipy
20
- ```
21
- For more detailed instructions, see the [Getting Started](https://cuqi-dtu.github.io/CUQIpy/user/getting_started.html) guide.
22
-
23
- ## Quick Example - UQ in 5 steps
24
- Image deconvolution with uncertainty quantification
25
- ```python
26
- # Imports
27
- import numpy as np
28
- import matplotlib.pyplot as plt
29
- from cuqi.testproblem import Deconvolution2D
30
- from cuqi.data import grains
31
- from cuqi.distribution import LMRF, Gaussian
32
- from cuqi.problem import BayesianProblem
33
-
34
- # Step 1: Model and data, y = Ax
35
- A, y_data, info = Deconvolution2D.get_components(dim=128, phantom=grains())
36
-
37
- # Step 2: Prior, x ~ LMRF(0,0.01)
38
- x = LMRF(location=0,
39
- scale=0.01,
40
- bc_type='neumann',
41
- geometry = A.domain_geometry)
42
-
43
- # Step 3: Likelihood, y ~ N(Ax, 0.0036^2)
44
- y = Gaussian(mean=A@x, cov=0.0036**2)
45
-
46
- # Step 4: Set up Bayesian problem and sample posterior
47
- BP = BayesianProblem(y, x).set_data(y=y_data)
48
- samples = BP.sample_posterior(200)
49
-
50
- # Step 5: Analysis
51
- info.exactSolution.plot(); plt.title("Exact solution")
52
- y_data.plot(); plt.title("Data")
53
- samples.plot_mean(); plt.title("Posterior mean")
54
- samples.plot_std(); plt.title("Posterior standard deviation")
55
- ```
56
-
57
- <p float="left">
58
- <img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_exact_sol.png" alt="Exact solution" width="330">
59
- <img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_data.png" alt="Data" width="330">
60
- <img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_post_mean.png" alt="Posterior mean" width="330">
61
- <img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_post_std.png" alt="Posterior standard deviation" width="330">
62
- </p>
63
-
64
- ## Plugins
65
- CUQIpy can be extended with additional functionality by installing optional plugins. These can be found at
66
- [CUQI-DTU](https://github.com/CUQI-DTU?q=CUQIpy-).
67
-
68
- ## Contributing
69
- We welcome contributions to CUQIpy. Please see our [contributing guidelines](https://cuqi-dtu.github.io/CUQIpy/dev/index.html) for more information.
70
-
71
- ## Contributors
72
-
73
- See the list of
74
- [contributors](https://github.com/CUQI-DTU/CUQIpy/graphs/contributors)
75
- who participated in this project.