From c8d2c6afbab34b7298afbfecf913f6f2bf498786 Mon Sep 17 00:00:00 2001 From: Moritz <email@moritz-huebner.de> Date: Mon, 29 Apr 2019 22:10:12 +1000 Subject: [PATCH] Fixed other checks --- bilby/core/result.py | 11 +++++++---- test/result_test.py | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/bilby/core/result.py b/bilby/core/result.py index 873ac2e31..f643d919e 100644 --- a/bilby/core/result.py +++ b/bilby/core/result.py @@ -1277,13 +1277,16 @@ class ResultList(list): return posteriors, result def _check_nested_samples(self): - if not np.all([res.nested_samples is not None for res in self]): - raise CombineResultError("Cannot combine results: No nested samples available " - "in all results") + for res in self: + try: + res.nested_samples + except ValueError: + raise CombineResultError("Cannot combine results: No nested samples available " + "in all results") def _check_consistent_priors(self): for res in self: - for p in self[0].search_parameter_keys: + for p in self[0].priors.keys(): if not self[0].priors[p] == res.priors[p] or len(self[0].priors) != len(res.priors): raise CombineResultError("Cannot combine results: inconsistent priors") diff --git a/test/result_test.py b/test/result_test.py index 64b7d51a0..049c9d407 100644 --- a/test/result_test.py +++ b/test/result_test.py @@ -524,6 +524,8 @@ class TestResultList(unittest.TestCase): result.log_evidence_err = 11 result.log_bayes_factor = 12 result.log_noise_evidence = 13 + result._nested_samples = None + self.nested_results.append(result) with self.assertRaises(bilby.result.CombineResultError): self.nested_results.combine() -- GitLab