diff --git a/bilby/core/result.py b/bilby/core/result.py index f643d919e9483bb3b0e3237d390fdf4a784a988a..d90876dc0f67084fb978426c36bb3a88bac10e72 100644 --- a/bilby/core/result.py +++ b/bilby/core/result.py @@ -1295,7 +1295,8 @@ class ResultList(list): raise CombineResultError("Cannot combine results: inconsistent parameters") def _check_consistent_data(self): - if not np.all([res.log_noise_evidence == self[0].log_noise_evidence for res in self]): + if not np.all([res.log_noise_evidence == self[0].log_noise_evidence for res in self])\ + and not np.all([np.isnan(res.log_noise_evidence) for res in self]): raise CombineResultError("Cannot combine results: inconsistent data") def _check_consistent_sampler(self): diff --git a/test/result_test.py b/test/result_test.py index 049c9d4076e535b18bac2932de558918ab077536..269afaa8e37164f422eca10fd784e272bd596b03 100644 --- a/test/result_test.py +++ b/test/result_test.py @@ -508,6 +508,11 @@ class TestResultList(unittest.TestCase): with self.assertRaises(bilby.result.CombineResultError): self.nested_results.combine() + def test_combine_inconsistent_data_nan(self): + self.nested_results[0].log_noise_evidence = np.nan + self.nested_results[1].log_noise_evidence = np.nan + self.nested_results.combine() + def test_combine_inconsistent_sampling_data(self): result = bilby.core.result.Result( label=self.label, outdir=self.outdir, sampler='cpnest',