diff --git a/bilby/core/sampler/ultranest.py b/bilby/core/sampler/ultranest.py index 687ed3c08e9f4d9e4fe0dc9eca17d07c83e1b3e1..82815557ce7581a00789036afd7067593eb4fcfc 100644 --- a/bilby/core/sampler/ultranest.py +++ b/bilby/core/sampler/ultranest.py @@ -372,20 +372,17 @@ class Ultranest(NestedSampler): self.start_time = current_time def _generate_result(self, out): - # extract results (samples stored in "v" will change to "points", - # weights stored in "w" will change to "weights") - datakey = "v" if "v" in out["weighted_samples"] else "points" - weightskey = "w" if "w" in out["weighted_samples"] else "weights" - data = np.array(out["weighted_samples"][datakey]) - weights = np.array(out["weighted_samples"][weightskey]) + # extract results + data = np.array(out["weighted_samples"]["points"]) + weights = np.array(out["weighted_samples"]["weights"]) scaledweights = weights / weights.max() mask = np.random.rand(len(scaledweights)) < scaledweights nested_samples = DataFrame(data, columns=self.search_parameter_keys) nested_samples["weights"] = weights - nested_samples["log_likelihood"] = out["weighted_samples"]["L"] - self.result.log_likelihood_evaluations = np.array(out["weighted_samples"]["L"])[ + nested_samples["log_likelihood"] = out["weighted_samples"]["logl"] + self.result.log_likelihood_evaluations = np.array(out["weighted_samples"]["logl"])[ mask ] self.result.sampler_output = out diff --git a/sampler_requirements.txt b/sampler_requirements.txt index be75cbcf66d1fb9ed2580607f3a1bdc7543b2c2c..88d479844ce4f69c1c4e4bdb7d8961f5f39b8d03 100644 --- a/sampler_requirements.txt +++ b/sampler_requirements.txt @@ -7,4 +7,4 @@ pymc3==3.6; python_version <= '2.7' pymc3>=3.6; python_version > '3.4' pymultinest kombine -ultranest +ultranest>=2.2.1