CUQIpy 1.1.0.post0.dev47__py3-none-any.whl → 1.1.1.post0.dev5__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.
- {CUQIpy-1.1.0.post0.dev47.dist-info → CUQIpy-1.1.1.post0.dev5.dist-info}/METADATA +1 -1
- {CUQIpy-1.1.0.post0.dev47.dist-info → CUQIpy-1.1.1.post0.dev5.dist-info}/RECORD +7 -7
- cuqi/_version.py +3 -3
- cuqi/distribution/_joint_distribution.py +21 -5
- {CUQIpy-1.1.0.post0.dev47.dist-info → CUQIpy-1.1.1.post0.dev5.dist-info}/LICENSE +0 -0
- {CUQIpy-1.1.0.post0.dev47.dist-info → CUQIpy-1.1.1.post0.dev5.dist-info}/WHEEL +0 -0
- {CUQIpy-1.1.0.post0.dev47.dist-info → CUQIpy-1.1.1.post0.dev5.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: CUQIpy
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.1.post0.dev5
|
|
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=
|
|
3
|
+
cuqi/_version.py,sha256=GBlEQB0vnqLdJQ4FNiN2Ih7mYmB2x4_rO95Eva1C9oI,508
|
|
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
|
|
@@ -24,7 +24,7 @@ cuqi/distribution/_gamma.py,sha256=9vljt5iaBDCHRhrVCMLc2RWDuBchZRQcv9buJMDYPlM,3
|
|
|
24
24
|
cuqi/distribution/_gaussian.py,sha256=DmmgVxKp4iEiEYWDdDcRoh35y14Oepn-zDHex0WVaYo,33316
|
|
25
25
|
cuqi/distribution/_gmrf.py,sha256=OwId8qQWEtmC2fxVhL4iBHZnc8ZCrZzfV6yGXDE3k30,9522
|
|
26
26
|
cuqi/distribution/_inverse_gamma.py,sha256=XRcNGW_jzORL08V7VvtsuMUoQioBAGbN12qe8hCXJvg,3309
|
|
27
|
-
cuqi/distribution/_joint_distribution.py,sha256=
|
|
27
|
+
cuqi/distribution/_joint_distribution.py,sha256=7TxDaZ7y362LfxEpD4I5Z0icdtsBmOBJGnpIkz_bYXA,15900
|
|
28
28
|
cuqi/distribution/_laplace.py,sha256=5exLvlzJm2AgfvZ3KUSkjfwlGwwbsktBxP8z0iLMik8,1401
|
|
29
29
|
cuqi/distribution/_lmrf.py,sha256=rdGoQ-fPe1oW6Z29P-l3woq0NX3_RxUQ2rzm1VzemNM,3290
|
|
30
30
|
cuqi/distribution/_lognormal.py,sha256=st1Uhf67qy2Seo65hA88JQ7lkEjQkW6KxznXahF_0SU,2844
|
|
@@ -85,8 +85,8 @@ cuqi/testproblem/_testproblem.py,sha256=x769LwwRdJdzIiZkcQUGb_5-vynNTNALXWKato7s
|
|
|
85
85
|
cuqi/utilities/__init__.py,sha256=H7xpJe2UinjZftKvE2JuXtTi4DqtkR6uIezStAXwfGg,428
|
|
86
86
|
cuqi/utilities/_get_python_variable_name.py,sha256=QwlBVj2koJRA8s8pWd554p7-ElcI7HUwY32HknaR92E,1827
|
|
87
87
|
cuqi/utilities/_utilities.py,sha256=Jc4knn80vLoA7kgw9FzXwKVFGaNBOXiA9kgvltZU3Ao,11777
|
|
88
|
-
CUQIpy-1.1.
|
|
89
|
-
CUQIpy-1.1.
|
|
90
|
-
CUQIpy-1.1.
|
|
91
|
-
CUQIpy-1.1.
|
|
92
|
-
CUQIpy-1.1.
|
|
88
|
+
CUQIpy-1.1.1.post0.dev5.dist-info/LICENSE,sha256=kJWRPrtRoQoZGXyyvu50Uc91X6_0XRaVfT0YZssicys,10799
|
|
89
|
+
CUQIpy-1.1.1.post0.dev5.dist-info/METADATA,sha256=PV1PVHglGQb4105G0vt1Px1jAmsP4PBQ91IvzVMiCFk,18389
|
|
90
|
+
CUQIpy-1.1.1.post0.dev5.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
|
|
91
|
+
CUQIpy-1.1.1.post0.dev5.dist-info/top_level.txt,sha256=AgmgMc6TKfPPqbjV0kvAoCBN334i_Lwwojc7HE3ZwD0,5
|
|
92
|
+
CUQIpy-1.1.1.post0.dev5.dist-info/RECORD,,
|
cuqi/_version.py
CHANGED
|
@@ -8,11 +8,11 @@ import json
|
|
|
8
8
|
|
|
9
9
|
version_json = '''
|
|
10
10
|
{
|
|
11
|
-
"date": "2024-08-
|
|
11
|
+
"date": "2024-08-31T21:02:04+0200",
|
|
12
12
|
"dirty": false,
|
|
13
13
|
"error": null,
|
|
14
|
-
"full-revisionid": "
|
|
15
|
-
"version": "1.1.
|
|
14
|
+
"full-revisionid": "b38281138379969a9a8c4683ba3ecf8a88031939",
|
|
15
|
+
"version": "1.1.1.post0.dev5"
|
|
16
16
|
}
|
|
17
17
|
''' # END VERSION_JSON
|
|
18
18
|
|
|
@@ -175,6 +175,10 @@ class JointDistribution:
|
|
|
175
175
|
kwargs[ordered_keys[index]] = arg
|
|
176
176
|
return kwargs
|
|
177
177
|
|
|
178
|
+
def _sum_evaluated_densities(self):
|
|
179
|
+
""" Return the sum of the evaluated densities in the joint distribution """
|
|
180
|
+
return sum([density.logd() for density in self._evaluated_densities])
|
|
181
|
+
|
|
178
182
|
def _reduce_to_single_density(self):
|
|
179
183
|
""" Reduce the joint distribution to a single density if possible.
|
|
180
184
|
|
|
@@ -183,7 +187,6 @@ class JointDistribution:
|
|
|
183
187
|
This method is a hack to allow our current samplers to work with
|
|
184
188
|
the joint distribution. It should be removed in the future.
|
|
185
189
|
"""
|
|
186
|
-
|
|
187
190
|
# Count number of distributions and likelihoods
|
|
188
191
|
n_dist = len(self._distributions)
|
|
189
192
|
n_likelihood = len(self._likelihoods)
|
|
@@ -201,16 +204,29 @@ class JointDistribution:
|
|
|
201
204
|
# Ensure parameter names match, otherwise return the joint distribution
|
|
202
205
|
if set(self._likelihoods[0].get_parameter_names()) != set(self._distributions[0].get_parameter_names()):
|
|
203
206
|
return self
|
|
204
|
-
return Posterior(self._likelihoods[0], self._distributions[0])
|
|
205
|
-
|
|
207
|
+
return self._add_constants_to_density(Posterior(self._likelihoods[0], self._distributions[0]))
|
|
208
|
+
|
|
206
209
|
# If exactly one distribution and no likelihoods its a Distribution
|
|
207
210
|
if n_dist == 1 and n_likelihood == 0:
|
|
208
|
-
return self._distributions[0]
|
|
209
|
-
|
|
211
|
+
return self._add_constants_to_density(self._distributions[0])
|
|
212
|
+
|
|
210
213
|
# If no distributions and exactly one likelihood its a Likelihood
|
|
211
214
|
if n_likelihood == 1 and n_dist == 0:
|
|
212
215
|
return self._likelihoods[0]
|
|
213
216
|
|
|
217
|
+
# If only evaluated densities left return joint to ensure logd method is available
|
|
218
|
+
if n_dist == 0 and n_likelihood == 0:
|
|
219
|
+
return self
|
|
220
|
+
|
|
221
|
+
def _add_constants_to_density(self, density: Density):
|
|
222
|
+
""" Add the constants (evaluated densities) to a single density. Used when reducing to single density. """
|
|
223
|
+
|
|
224
|
+
if isinstance(density, EvaluatedDensity):
|
|
225
|
+
raise ValueError("Cannot add the sum of all evaluated densities to an EvaluatedDensity.")
|
|
226
|
+
|
|
227
|
+
density._constant += self._sum_evaluated_densities()
|
|
228
|
+
return density
|
|
229
|
+
|
|
214
230
|
def _as_stacked(self) -> _StackedJointDistribution:
|
|
215
231
|
""" Return a stacked JointDistribution with the same densities. """
|
|
216
232
|
return _StackedJointDistribution(*self._densities)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|