CUQIpy 1.2.0.post0.dev342__tar.gz → 1.2.0.post0.dev352__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 (122) hide show
  1. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/CUQIpy.egg-info/PKG-INFO +1 -1
  2. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/PKG-INFO +1 -1
  3. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/_version.py +3 -3
  4. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/implicitprior/_restorator.py +18 -6
  5. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/tests/test_implicit_priors.py +27 -1
  6. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/CUQIpy.egg-info/SOURCES.txt +0 -0
  7. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/CUQIpy.egg-info/dependency_links.txt +0 -0
  8. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/CUQIpy.egg-info/requires.txt +0 -0
  9. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/CUQIpy.egg-info/top_level.txt +0 -0
  10. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/LICENSE +0 -0
  11. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/README.md +0 -0
  12. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/__init__.py +0 -0
  13. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/_messages.py +0 -0
  14. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/array/__init__.py +0 -0
  15. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/array/_array.py +0 -0
  16. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/config.py +0 -0
  17. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/data/__init__.py +0 -0
  18. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/data/_data.py +0 -0
  19. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/data/astronaut.npz +0 -0
  20. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/data/camera.npz +0 -0
  21. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/data/cat.npz +0 -0
  22. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/data/cookie.png +0 -0
  23. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/data/satellite.mat +0 -0
  24. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/density/__init__.py +0 -0
  25. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/density/_density.py +0 -0
  26. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/diagnostics.py +0 -0
  27. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/distribution/__init__.py +0 -0
  28. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/distribution/_beta.py +0 -0
  29. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/distribution/_cauchy.py +0 -0
  30. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/distribution/_cmrf.py +0 -0
  31. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/distribution/_custom.py +0 -0
  32. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/distribution/_distribution.py +0 -0
  33. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/distribution/_gamma.py +0 -0
  34. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/distribution/_gaussian.py +0 -0
  35. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/distribution/_gmrf.py +0 -0
  36. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/distribution/_inverse_gamma.py +0 -0
  37. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/distribution/_joint_distribution.py +0 -0
  38. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/distribution/_laplace.py +0 -0
  39. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/distribution/_lmrf.py +0 -0
  40. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/distribution/_lognormal.py +0 -0
  41. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/distribution/_modifiedhalfnormal.py +0 -0
  42. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/distribution/_normal.py +0 -0
  43. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/distribution/_posterior.py +0 -0
  44. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/distribution/_smoothed_laplace.py +0 -0
  45. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/distribution/_truncated_normal.py +0 -0
  46. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/distribution/_uniform.py +0 -0
  47. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/experimental/__init__.py +0 -0
  48. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/experimental/algebra/__init__.py +0 -0
  49. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/experimental/algebra/_ast.py +0 -0
  50. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/experimental/mcmc/__init__.py +0 -0
  51. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/experimental/mcmc/_conjugate.py +0 -0
  52. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/experimental/mcmc/_conjugate_approx.py +0 -0
  53. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/experimental/mcmc/_cwmh.py +0 -0
  54. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/experimental/mcmc/_direct.py +0 -0
  55. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/experimental/mcmc/_gibbs.py +0 -0
  56. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/experimental/mcmc/_hmc.py +0 -0
  57. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/experimental/mcmc/_langevin_algorithm.py +0 -0
  58. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/experimental/mcmc/_laplace_approximation.py +0 -0
  59. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/experimental/mcmc/_mh.py +0 -0
  60. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/experimental/mcmc/_pcn.py +0 -0
  61. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/experimental/mcmc/_rto.py +0 -0
  62. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/experimental/mcmc/_sampler.py +0 -0
  63. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/experimental/mcmc/_utilities.py +0 -0
  64. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/geometry/__init__.py +0 -0
  65. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/geometry/_geometry.py +0 -0
  66. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/implicitprior/__init__.py +0 -0
  67. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/implicitprior/_regularizedGMRF.py +0 -0
  68. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/implicitprior/_regularizedGaussian.py +0 -0
  69. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/implicitprior/_regularizedUnboundedUniform.py +0 -0
  70. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/likelihood/__init__.py +0 -0
  71. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/likelihood/_likelihood.py +0 -0
  72. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/model/__init__.py +0 -0
  73. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/model/_model.py +0 -0
  74. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/operator/__init__.py +0 -0
  75. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/operator/_operator.py +0 -0
  76. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/pde/__init__.py +0 -0
  77. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/pde/_pde.py +0 -0
  78. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/problem/__init__.py +0 -0
  79. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/problem/_problem.py +0 -0
  80. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/sampler/__init__.py +0 -0
  81. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/sampler/_conjugate.py +0 -0
  82. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/sampler/_conjugate_approx.py +0 -0
  83. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/sampler/_cwmh.py +0 -0
  84. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/sampler/_gibbs.py +0 -0
  85. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/sampler/_hmc.py +0 -0
  86. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/sampler/_langevin_algorithm.py +0 -0
  87. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/sampler/_laplace_approximation.py +0 -0
  88. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/sampler/_mh.py +0 -0
  89. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/sampler/_pcn.py +0 -0
  90. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/sampler/_rto.py +0 -0
  91. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/sampler/_sampler.py +0 -0
  92. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/samples/__init__.py +0 -0
  93. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/samples/_samples.py +0 -0
  94. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/solver/__init__.py +0 -0
  95. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/solver/_solver.py +0 -0
  96. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/testproblem/__init__.py +0 -0
  97. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/testproblem/_testproblem.py +0 -0
  98. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/utilities/__init__.py +0 -0
  99. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/utilities/_get_python_variable_name.py +0 -0
  100. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/cuqi/utilities/_utilities.py +0 -0
  101. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/pyproject.toml +0 -0
  102. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/requirements.txt +0 -0
  103. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/setup.cfg +0 -0
  104. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/setup.py +0 -0
  105. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/tests/test_MRFs.py +0 -0
  106. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/tests/test_abstract_distribution_density.py +0 -0
  107. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/tests/test_bayesian_inversion.py +0 -0
  108. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/tests/test_density.py +0 -0
  109. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/tests/test_distribution.py +0 -0
  110. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/tests/test_distributions_shape.py +0 -0
  111. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/tests/test_geometry.py +0 -0
  112. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/tests/test_joint_distribution.py +0 -0
  113. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/tests/test_likelihood.py +0 -0
  114. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/tests/test_model.py +0 -0
  115. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/tests/test_pde.py +0 -0
  116. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/tests/test_posterior.py +0 -0
  117. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/tests/test_problem.py +0 -0
  118. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/tests/test_sampler.py +0 -0
  119. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/tests/test_samples.py +0 -0
  120. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/tests/test_solver.py +0 -0
  121. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/tests/test_testproblem.py +0 -0
  122. {cuqipy-1.2.0.post0.dev342 → cuqipy-1.2.0.post0.dev352}/tests/test_utilities.py +0 -0
@@ -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
  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
@@ -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):
@@ -28,7 +28,7 @@ def test_RegularizedGaussian_guarding_statements():
28
28
 
29
29
  with pytest.raises(ValueError, match="Projector should take 1 argument"):
30
30
  cuqi.implicitprior.RegularizedGaussian(np.zeros(5), 1, projector=lambda s,z: s)
31
-
31
+
32
32
  def test_creating_restorator():
33
33
  """ Test creating the object from restorator class."""
34
34
 
@@ -38,6 +38,32 @@ def test_creating_restorator():
38
38
  assert np.allclose(restorator.restore(np.ones(4), 0.1), np.ones(4))
39
39
  assert restorator.info == True
40
40
 
41
+ def test_handling_invalid_restorator():
42
+ """ Test handling invalid restorator."""
43
+ # Invalid return type 1: None
44
+ def func_1(x, restoration_strength=0.1):
45
+ return
46
+ restore_prior_1 = cuqi.implicitprior.RestorationPrior(func_1)
47
+ with pytest.raises(ValueError, match=r"Unsupported return type .*"):
48
+ restore_prior_1.restore(np.ones(4), 0.1)
49
+ # Invalid return type 2: one parameter
50
+ def func_2(x, restoration_strength=0.1):
51
+ return x
52
+ restore_prior_2 = cuqi.implicitprior.RestorationPrior(func_2)
53
+ with pytest.raises(ValueError, match=r"Unsupported return type .*"):
54
+ restore_prior_2.restore(np.ones(4), 0.1)
55
+ # Invalid return type 3: tuple with 3 elements
56
+ def func_3(x, restoration_strength=0.1):
57
+ return x, None, False
58
+ restore_prior_3 = cuqi.implicitprior.RestorationPrior(func_3)
59
+ with pytest.raises(ValueError, match=r"Unsupported return type .*"):
60
+ restore_prior_3.restore(np.ones(4), 0.1)
61
+ # Invalid return type 4: list with 2 elements
62
+ def func_4(x, restoration_strength=0.1):
63
+ return [x, None]
64
+ restore_prior_4 = cuqi.implicitprior.RestorationPrior(func_4)
65
+ with pytest.raises(ValueError, match=r"Unsupported return type .*"):
66
+ restore_prior_4.restore(np.ones(4), 0.1)
41
67
 
42
68
  def test_creating_restorator_with_potential():
43
69
  """ Test creating the object from restorator class with a potential."""