Skip to content
Snippets Groups Projects
Commit f43d44e9 authored by Gregory Ashton's avatar Gregory Ashton Committed by Moritz Huebner
Browse files

Resolve "add `filename=' option to `plot_corner'"

parent 2d42fa86
No related branches found
No related tags found
No related merge requests found
......@@ -270,8 +270,8 @@ class Result(dict):
string = r"${{{0}}}_{{-{1}}}^{{+{2}}}$"
return string.format(fmt(median), fmt(lower), fmt(upper))
def plot_corner(self, parameters=None, save=True, priors=None, dpi=300,
titles=True, **kwargs):
def plot_corner(self, parameters=None, priors=None, titles=True, save=True,
filename=None, dpi=300, **kwargs):
""" Plot a corner-plot using corner
See https://corner.readthedocs.io/en/latest/ for a detailed API.
......@@ -280,18 +280,20 @@ class Result(dict):
----------
parameters: list, optional
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
titles: bool
If true, add 1D titles of the median and (by default 1-sigma)
error bars. To change the error bars, pass in the quantiles kwarg.
See method `get_one_dimensional_median_and_error_bar` for further
details). If `quantiles=None` is passed in, no title is added.
save: bool, optional
If true, save the image using the given label and outdir
filename: str, optional
If given, overwrite the default filename
dpi: int, optional
Dots per inch resolution of the plot
**kwargs:
Other keyword arguments are passed to `corner.corner`. We set some
defaults to improve the basic look and feel, but these can all be
......@@ -368,8 +370,9 @@ class Result(dict):
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)
if filename is None:
utils.check_directory_exists_and_if_not_mkdir(self.outdir)
filename = '{}/{}_corner.png'.format(self.outdir, self.label)
logger.debug('Saving corner plot to {}'.format(filename))
fig.savefig(filename, dpi=dpi)
......
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