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

Add functionality to plot the priors on the 1D marginals

parent 92d57abd
No related branches found
No related tags found
No related merge requests found
Pipeline #30300 passed
......@@ -248,6 +248,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:
......@@ -307,6 +310,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