CUQIpy 0.5.0.post0.dev27__py3-none-any.whl → 0.5.0.post0.dev34__py3-none-any.whl
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.
- {CUQIpy-0.5.0.post0.dev27.dist-info → CUQIpy-0.5.0.post0.dev34.dist-info}/METADATA +63 -39
- {CUQIpy-0.5.0.post0.dev27.dist-info → CUQIpy-0.5.0.post0.dev34.dist-info}/RECORD +7 -7
- cuqi/_version.py +3 -3
- cuqi/data/_data.py +4 -2
- {CUQIpy-0.5.0.post0.dev27.dist-info → CUQIpy-0.5.0.post0.dev34.dist-info}/LICENSE +0 -0
- {CUQIpy-0.5.0.post0.dev27.dist-info → CUQIpy-0.5.0.post0.dev34.dist-info}/WHEEL +0 -0
- {CUQIpy-0.5.0.post0.dev27.dist-info → CUQIpy-0.5.0.post0.dev34.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: CUQIpy
|
|
3
|
-
Version: 0.5.0.post0.
|
|
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
|
[](https://github.com/CUQI-DTU/CUQIpy/actions/workflows/tests.yml)
|
|
215
215
|
[](https://cuqi-dtu.github.io/CUQIpy/)
|
|
216
|
+
[](https://pypi.org/project/CUQIpy/#history)
|
|
216
217
|
|
|
217
|
-
Computational Uncertainty Quantification for Inverse Problems in python
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
##
|
|
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
|
|
231
|
-
Image deconvolution with
|
|
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.
|
|
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:
|
|
242
|
-
A, y_data, info = Deconvolution2D.get_components(dim=
|
|
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
|
|
251
|
-
|
|
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
|
|
254
|
-
BP = BayesianProblem(y, x)
|
|
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
|
|
258
|
-
info.exactSolution.plot(); plt.title("
|
|
259
|
-
y_data.plot(); plt.title("
|
|
260
|
-
samples.plot_mean(); plt.title("
|
|
261
|
-
samples.plot_std(); plt.title("
|
|
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="
|
|
266
|
-
<img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_data.png" alt="
|
|
267
|
-
<img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_post_mean.png" alt="
|
|
268
|
-
<img src="https://cuqi-dtu.github.io/CUQIpy/_images/deconv2D_post_std.png" alt="
|
|
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.
|
|
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
|
-
|
|
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
|
-
##
|
|
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
|
-
|
|
281
|
-
[
|
|
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,12 +1,12 @@
|
|
|
1
1
|
cuqi/__init__.py,sha256=K0ss2HNqoLUX7wGpSZdaPKxIaKdRS452fcJm4D0pcEs,433
|
|
2
2
|
cuqi/_messages.py,sha256=fzEBrZT2kbmfecBBPm7spVu7yHdxGARQB4QzXhJbCJ0,415
|
|
3
|
-
cuqi/_version.py,sha256=
|
|
3
|
+
cuqi/_version.py,sha256=YG7wYnRbkAbc5L66X7naOLB81WxNl5GSQQD7Rjku_I8,509
|
|
4
4
|
cuqi/config.py,sha256=wcYvz19wkeKW2EKCGIKJiTpWt5kdaxyt4imyRkvtTRA,526
|
|
5
5
|
cuqi/diagnostics.py,sha256=5OrbJeqpynqRXOe5MtOKKhe7EAVdOEpHIqHnlMW9G_c,3029
|
|
6
6
|
cuqi/array/__init__.py,sha256=-EeiaiWGNsE3twRS4dD814BIlfxEsNkTCZUc5gjOXb0,30
|
|
7
7
|
cuqi/array/_array.py,sha256=Xm2n1MFnLhR3KUjoCzMc-tnZ5HBX1mQ8MyxhZnIvSCA,4400
|
|
8
8
|
cuqi/data/__init__.py,sha256=1aGgPmtG_Kqbb880vLnPksGvyYQB_6o2mz_q-4KGYaU,173
|
|
9
|
-
cuqi/data/_data.py,sha256=
|
|
9
|
+
cuqi/data/_data.py,sha256=PgdYJ6MHgNY37Ak8wUYwvxcAwOYSNjnf1-BXMdbnuv4,10716
|
|
10
10
|
cuqi/data/astronaut.npz,sha256=vVTb6eJLMZhrEZuOYzQWN3V2EhhVH6sHzrrf_7mstcw,786696
|
|
11
11
|
cuqi/data/camera.npz,sha256=EznyKfAomn4orm-L9gqM3QDFNuGB5XZwpZZMwDgiMKk,262408
|
|
12
12
|
cuqi/data/cat.npz,sha256=9H9iJqkvlCCVZZ2IWMfwwfVHbShpQTkZo_WGr7rrp3k,406164
|
|
@@ -63,8 +63,8 @@ cuqi/testproblem/_testproblem.py,sha256=x769LwwRdJdzIiZkcQUGb_5-vynNTNALXWKato7s
|
|
|
63
63
|
cuqi/utilities/__init__.py,sha256=EfxHLdsyDNugbmbzs43nV_AeKcycM9sVBjG9WZydagA,351
|
|
64
64
|
cuqi/utilities/_get_python_variable_name.py,sha256=QwlBVj2koJRA8s8pWd554p7-ElcI7HUwY32HknaR92E,1827
|
|
65
65
|
cuqi/utilities/_utilities.py,sha256=rjycaxDWExdskIfYXV1z5ZlB0JTlqv3tCmKf08i6U5c,7973
|
|
66
|
-
CUQIpy-0.5.0.post0.
|
|
67
|
-
CUQIpy-0.5.0.post0.
|
|
68
|
-
CUQIpy-0.5.0.post0.
|
|
69
|
-
CUQIpy-0.5.0.post0.
|
|
70
|
-
CUQIpy-0.5.0.post0.
|
|
66
|
+
CUQIpy-0.5.0.post0.dev34.dist-info/LICENSE,sha256=kJWRPrtRoQoZGXyyvu50Uc91X6_0XRaVfT0YZssicys,10799
|
|
67
|
+
CUQIpy-0.5.0.post0.dev34.dist-info/METADATA,sha256=KvQwyxbFj4m1wYkmXxgwjTW2DH6WHKigrqCoKhrTlPM,18348
|
|
68
|
+
CUQIpy-0.5.0.post0.dev34.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
|
69
|
+
CUQIpy-0.5.0.post0.dev34.dist-info/top_level.txt,sha256=AgmgMc6TKfPPqbjV0kvAoCBN334i_Lwwojc7HE3ZwD0,5
|
|
70
|
+
CUQIpy-0.5.0.post0.dev34.dist-info/RECORD,,
|
cuqi/_version.py
CHANGED
|
@@ -8,11 +8,11 @@ import json
|
|
|
8
8
|
|
|
9
9
|
version_json = '''
|
|
10
10
|
{
|
|
11
|
-
"date": "2023-10-
|
|
11
|
+
"date": "2023-10-06T17:16:50+0200",
|
|
12
12
|
"dirty": false,
|
|
13
13
|
"error": null,
|
|
14
|
-
"full-revisionid": "
|
|
15
|
-
"version": "0.5.0.post0.
|
|
14
|
+
"full-revisionid": "900bab604f6c0683ac7ffd1f2a912296b85e5467",
|
|
15
|
+
"version": "0.5.0.post0.dev34"
|
|
16
16
|
}
|
|
17
17
|
''' # END VERSION_JSON
|
|
18
18
|
|
cuqi/data/_data.py
CHANGED
|
@@ -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
|
-
|
|
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):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|