CUQIpy 1.2.0.post0.dev342__py3-none-any.whl → 1.2.0.post0.dev352__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.

Potentially problematic release.


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

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: CUQIpy
3
- Version: 1.2.0.post0.dev342
3
+ Version: 1.2.0.post0.dev352
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>, Chao Zhang <chaz@dtu.dk>
6
6
  License: Apache License
@@ -1,6 +1,6 @@
1
1
  cuqi/__init__.py,sha256=LsGilhl-hBLEn6Glt8S_l0OJzAA1sKit_rui8h-D-p0,488
2
2
  cuqi/_messages.py,sha256=fzEBrZT2kbmfecBBPm7spVu7yHdxGARQB4QzXhJbCJ0,415
3
- cuqi/_version.py,sha256=3ljcYFr3ZS-sk3bvctKBFOKTMiiZYLbPdoHP03jbCfk,510
3
+ cuqi/_version.py,sha256=C3E_fdIvWSE-v7utMG2sMEohKeQFQh02EkThKcjI6Ic,510
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
@@ -57,7 +57,7 @@ cuqi/implicitprior/__init__.py,sha256=6z3lvw-tWDyjZSpB3pYzvijSMK9Zlf1IYqOVTtMD2h
57
57
  cuqi/implicitprior/_regularizedGMRF.py,sha256=rr3R2C1aheuu_KD35MureZKfOwY8O1pkVDHvuaFnFFU,6300
58
58
  cuqi/implicitprior/_regularizedGaussian.py,sha256=mzaAHq0yz73FZo-OB2iqFMd2i2NNzVv4mjd9-ger8a0,15435
59
59
  cuqi/implicitprior/_regularizedUnboundedUniform.py,sha256=H2fTOSqYTlDiLxQ7Ya6wnpCUIkpO4qKrkTOsOPnBBeU,3483
60
- cuqi/implicitprior/_restorator.py,sha256=ixnH8RGcLpqlaIUdR5Dwjx72sO9f3BeotNFRC7Z7qZo,9198
60
+ cuqi/implicitprior/_restorator.py,sha256=Z350XUJEt7N59Qw-SIUaBljQNDJk4Zb0i_KRFrt2DCg,10087
61
61
  cuqi/likelihood/__init__.py,sha256=QXif382iwZ5bT3ZUqmMs_n70JVbbjxbqMrlQYbMn4Zo,1776
62
62
  cuqi/likelihood/_likelihood.py,sha256=z3AXAbIrv_DjOYh4jy3iDHemuIFUUJu6wdvJ5e2dgW0,6913
63
63
  cuqi/model/__init__.py,sha256=jgY2-jyxEMC79vkyH9BpfowW7_DbMRjqedOtO5fykXQ,62
@@ -89,8 +89,8 @@ cuqi/testproblem/_testproblem.py,sha256=x769LwwRdJdzIiZkcQUGb_5-vynNTNALXWKato7s
89
89
  cuqi/utilities/__init__.py,sha256=H7xpJe2UinjZftKvE2JuXtTi4DqtkR6uIezStAXwfGg,428
90
90
  cuqi/utilities/_get_python_variable_name.py,sha256=QwlBVj2koJRA8s8pWd554p7-ElcI7HUwY32HknaR92E,1827
91
91
  cuqi/utilities/_utilities.py,sha256=Jc4knn80vLoA7kgw9FzXwKVFGaNBOXiA9kgvltZU3Ao,11777
92
- CUQIpy-1.2.0.post0.dev342.dist-info/LICENSE,sha256=kJWRPrtRoQoZGXyyvu50Uc91X6_0XRaVfT0YZssicys,10799
93
- CUQIpy-1.2.0.post0.dev342.dist-info/METADATA,sha256=gzSVkU5NkQHKRqldZB3uQ9m1ef9_2ZFmAIt1Q0wDeYo,18529
94
- CUQIpy-1.2.0.post0.dev342.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
95
- CUQIpy-1.2.0.post0.dev342.dist-info/top_level.txt,sha256=AgmgMc6TKfPPqbjV0kvAoCBN334i_Lwwojc7HE3ZwD0,5
96
- CUQIpy-1.2.0.post0.dev342.dist-info/RECORD,,
92
+ CUQIpy-1.2.0.post0.dev352.dist-info/LICENSE,sha256=kJWRPrtRoQoZGXyyvu50Uc91X6_0XRaVfT0YZssicys,10799
93
+ CUQIpy-1.2.0.post0.dev352.dist-info/METADATA,sha256=O3no2L4vDQEK-vO2bF_jWmHLydUYcXR6FN8deJHucmk,18529
94
+ CUQIpy-1.2.0.post0.dev352.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
95
+ CUQIpy-1.2.0.post0.dev352.dist-info/top_level.txt,sha256=AgmgMc6TKfPPqbjV0kvAoCBN334i_Lwwojc7HE3ZwD0,5
96
+ CUQIpy-1.2.0.post0.dev352.dist-info/RECORD,,
cuqi/_version.py CHANGED
@@ -8,11 +8,11 @@ import json
8
8
 
9
9
  version_json = '''
10
10
  {
11
- "date": "2024-11-25T09:18:51+0100",
11
+ "date": "2024-11-28T12:43:32+0100",
12
12
  "dirty": false,
13
13
  "error": null,
14
- "full-revisionid": "63395d14f6c3f964633b20200ada13b8a213da20",
15
- "version": "1.2.0.post0.dev342"
14
+ "full-revisionid": "6f800787a63fef7d6ba2c0b88b96dbc209afdbad",
15
+ "version": "1.2.0.post0.dev352"
16
16
  }
17
17
  ''' # END VERSION_JSON
18
18
 
@@ -15,8 +15,10 @@ class RestorationPrior(Distribution):
15
15
  Parameters
16
16
  ----------
17
17
  restorator : callable f(x, restoration_strength)
18
- Function f that accepts input x to be restored and returns the
19
- restored version of x and information about the restoration operation.
18
+ Function f that accepts input x to be restored and returns a two-element
19
+ tuple of the restored version of x and extra information about the
20
+ restoration operation. The second element can be of any type, including
21
+ `None` in case there is no information.
20
22
 
21
23
  restorator_kwargs : dictionary
22
24
  Dictionary containing information about the restorator.
@@ -41,8 +43,9 @@ class RestorationPrior(Distribution):
41
43
  super().__init__(**kwargs)
42
44
 
43
45
  def restore(self, x, restoration_strength):
44
- """This function allows us to restore the input x and returns the
45
- restored version of x.
46
+ """This function allows us to restore the input x with the user-supplied
47
+ restorator. Extra information about the restoration operation is stored
48
+ in the `RestorationPrior` info attribute.
46
49
 
47
50
  Parameters
48
51
  ----------
@@ -54,9 +57,18 @@ class RestorationPrior(Distribution):
54
57
  restorator is a denoiser, this parameter might correspond to the
55
58
  noise level.
56
59
  """
57
- solution, info = self.restorator(x, restoration_strength=restoration_strength,
60
+ restorator_return = self.restorator(x, restoration_strength=restoration_strength,
58
61
  **self.restorator_kwargs)
59
- self.info = info
62
+
63
+ if type(restorator_return) == tuple and len(restorator_return) == 2:
64
+ solution, self.info = restorator_return
65
+ else:
66
+ raise ValueError("Unsupported return type from the user-supplied restorator function. "+
67
+ "Please ensure that the restorator function returns a two-element tuple with the "+
68
+ "restored solution as the first element and additional information about the "+
69
+ "restoration as the second element. The second element can be of any type, "+
70
+ "including `None` in case there is no particular information.")
71
+
60
72
  return solution
61
73
 
62
74
  def logpdf(self, x):