Commit ebeb6c4b authored by Gregory Ashton's avatar Gregory Ashton

Initial work on adding a merge result option

parent b237c32e
Pipeline #55722 failed with stage
in 5 minutes and 36 seconds
......@@ -1246,6 +1246,20 @@ def plot_multiple(results, filename=None, labels=None, colours=None,
return fig
def _merge_two_results(resultA, resultB):
result = Result()
joined_posterior = pd.concat((resultA.posterior, resultB.posterior))
result.posterior = joined_posterior.sample(len(joined_posterior))
return result
def merge_results(results_list):
result = _merge_two_results(results_list[0], results_list[1])
result.label = 'TEST'
result.outdir = '.'
return result
def make_pp_plot(results, filename=None, save=True, **kwargs):
Make a P-P plot for a set of runs with injected signals.
......@@ -29,12 +29,13 @@ import bilby
def setup_command_line_args():
parser = argparse.ArgumentParser(
description="Helper tool for bilby result files",
description="Helper tool for bilby result files")
parser.add_argument("-r", "--results", nargs='+', required=True,
help="List of results files.")
parser.add_argument("-c", "--convert", type=str, choices=['json', 'hdf5'],
help="Convert all results.", default=False)
parser.add_argument("-m", "--merge", action='store_true',
help="Merge all results.", default=False)
parser.add_argument("-o", "--outdir", type=str, default=None,
help="Output directory.")
parser.add_argument("-b", "--bayes", action='store_true',
......@@ -97,3 +98,8 @@ def main():
if args.ipython:
if args.merge:
result = bilby.core.result._merge_results(*results_list)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment