Skip to content
Snippets Groups Projects
Commit 14623aab authored by Gregory Ashton's avatar Gregory Ashton
Browse files

Adds pvalue return to the pp plot generation script

Useful if the pvalues needs to be logged elsewhere from a script
parent de3e6d3d
No related branches found
No related tags found
1 merge request!465Adds pvalue return to the pp plot generation script
Pipeline #59759 passed
......@@ -1350,8 +1350,9 @@ def make_pp_plot(results, filename=None, save=True, confidence_interval=0.9,
Returns
-------
fig:
matplotlib figure
fig, pvals:
matplotlib figure and a NamedTuple with attributes `combined_pvalue`,
`pvalues`, and `names`.
"""
credible_levels = pd.DataFrame()
......@@ -1400,9 +1401,13 @@ def make_pp_plot(results, filename=None, save=True, confidence_interval=0.9,
filename = 'outdir/pp.png'
fig.savefig(filename, dpi=500)
Pvals = namedtuple('pvals', ['combined_pvalue', 'pvalues', 'names'])
pvals = Pvals(combined_pvalue=scipy.stats.combine_pvalues(pvalues)[1],
pvalues=pvalues,
names=list(credible_levels.keys()))
logger.info(
"Combined p-value: {}".format(scipy.stats.combine_pvalues(pvalues)[1]))
return fig
"Combined p-value: {}".format(pvals.combined_pvalue))
return fig, pvals
class ResultError(Exception):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment