From 73e4230ba3fffef3116604808da8afa759b6e96f Mon Sep 17 00:00:00 2001
From: Moritz Huebner <moritz.huebner@ligo.org>
Date: Thu, 17 Jun 2021 02:18:33 +0000
Subject: [PATCH] Fixes issue that causes ConditionalDeltaFunction posterior
 samples not to be saved correctly

---
 bilby/core/result.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/bilby/core/result.py b/bilby/core/result.py
index f81558c2a..00b66869e 100644
--- a/bilby/core/result.py
+++ b/bilby/core/result.py
@@ -22,7 +22,7 @@ from .utils import (
     recursively_load_dict_contents_from_group,
     recursively_decode_bilby_json,
 )
-from .prior import Prior, PriorDict, DeltaFunction
+from .prior import Prior, PriorDict, DeltaFunction, ConditionalDeltaFunction
 
 
 def result_file_name(outdir, label, extension='json', gzip=False):
@@ -1399,7 +1399,8 @@ class Result(object):
         if priors is None:
             return posterior
         for key in priors:
-            if isinstance(priors[key], DeltaFunction):
+            if isinstance(priors[key], DeltaFunction) and \
+                    not isinstance(priors[key], ConditionalDeltaFunction):
                 posterior[key] = priors[key].peak
             elif isinstance(priors[key], float):
                 posterior[key] = priors[key]
-- 
GitLab