Skip to content
Snippets Groups Projects
Commit 0266f12b authored by Colm Talbot's avatar Colm Talbot
Browse files

fix reorder_likelihoods

parent e42c0179
No related branches found
No related tags found
No related merge requests found
......@@ -412,15 +412,16 @@ class NestedSampler(Sampler):
Parameters
----------
sorted_samples, unsorted_samples: array
Sorted and unsorted values of the samples. These should be of the same
shape and contain the same sample values, but in different orders
unsorted_loglikelihoods: array
sorted_samples, unsorted_samples: array-like
Sorted and unsorted values of the samples. These should be of the
same shape and contain the same sample values, but in different
orders
unsorted_loglikelihoods: array-like
The loglikelihoods corresponding to the unsorted_samples
Returns
-------
sorted_loglikelihoods: array
sorted_loglikelihoods: array-like
The loglikelihoods reordered to match that of the sorted_samples
......@@ -428,12 +429,13 @@ class NestedSampler(Sampler):
idxs = []
for ii in range(len(unsorted_loglikelihoods)):
idx = np.where(np.all(sorted_samples[ii] == unsorted_samples, axis=1))
idx = np.where(np.all(sorted_samples[ii] == unsorted_samples,
axis=1))[0]
if len(idx) > 1:
raise ValueError(
"Multiple matches found between sorted and unsorted samples")
else:
idxs.append(idx[0])
logger.warning(
"Multiple likwlihood matches found between sorted and "
"unsorted samples. Taking the first match.")
idxs.append(idx[0])
return unsorted_loglikelihoods[idxs]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment