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

Merge branch 'add-priors-to-corner-plots'

parents 7ce4e3a8 45bcef1b
No related branches found
No related tags found
No related merge requests found
......@@ -249,6 +249,9 @@ class Result(dict):
If given, a list of the parameter names to include
save: bool, optional
If true, save the image using the given label and outdir
priors: tupak.core.prior.PriorSet
If given, add the prior probability density functions to the
one-dimensional marginal distributions
dpi: int, optional
Dots per inch resolution of the plot
**kwargs:
......@@ -308,6 +311,13 @@ class Result(dict):
fig = corner.corner(xs, **kwargs)
axes = fig.get_axes()
if priors is not None:
for i, par in enumerate(parameters):
ax = axes[i + i * len(parameters)]
theta = np.linspace(ax.get_xlim()[0], ax.get_xlim()[1], 300)
ax.plot(theta, priors[par].prob(theta), color='C2')
if save:
utils.check_directory_exists_and_if_not_mkdir(self.outdir)
filename = '{}/{}_corner.png'.format(self.outdir, self.label)
......
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