Commit ed582027 authored by Charlie Hoy's avatar Charlie Hoy
Browse files

Merge branch 'display_bilby_prior_file' into 'master'

Display bilby prior file on config tab

See merge request lscsoft/pesummary!513
parents baf680bc ee889b99
......@@ -85,7 +85,8 @@ class _CoreWebpageGeneration(PostProcessing):
package_information=self.package_information,
mcmc_samples=self.mcmc_samples,
external_hdf5_links=self.external_hdf5_links, key_data=key_data,
existing_plot=self.existing_plot, disable_expert=self.disable_expert
existing_plot=self.existing_plot, disable_expert=self.disable_expert,
analytic_priors=self.analytic_prior_dict
)
def generate_webpages(self):
......@@ -137,7 +138,8 @@ class _GWWebpageGeneration(GWPostProcessing):
mcmc_samples=self.mcmc_samples, existing_plot=self.existing_plot,
external_hdf5_links=self.external_hdf5_links,
preliminary_pages=self.preliminary_pages,
disable_expert=self.disable_expert
disable_expert=self.disable_expert,
analytic_priors=self.analytic_prior_dict
)
def generate_webpages(self):
......@@ -189,7 +191,8 @@ class _PublicGWWebpageGeneration(GWPostProcessing):
mcmc_samples=self.mcmc_samples, existing_plot=self.existing_plot,
external_hdf5_links=self.external_hdf5_links,
preliminary_pages=self.preliminary_pages,
disable_expert=self.disable_expert
disable_expert=self.disable_expert,
analytic_priors=self.analytic_prior_dict
)
def generate_webpages(self):
......
......@@ -1997,6 +1997,18 @@ class PostProcessing(object):
if self.mcmc_samples:
self.samples = {label: self.samples.T for label in self.labels}
@property
def analytic_prior_dict(self):
return {
label: "\n".join(
[
"{} = {}".format(key, value) for key, value in
self.priors["analytic"][label].items()
]
) if "analytic" in self.priors.keys() and label in
self.priors["analytic"].keys() else None for label in self.labels
}
@property
def same_parameters(self):
return self._same_parameters
......
......@@ -123,7 +123,7 @@ class _WebpageGeneration(object):
disable_comparison=False, disable_interactive=False,
package_information={"packages": [], "manager": "pypi"},
mcmc_samples=False, external_hdf5_links=False, key_data=None,
existing_plot=None, disable_expert=False
existing_plot=None, disable_expert=False, analytic_priors=None
):
self.webdir = webdir
make_dir(self.webdir)
......@@ -153,6 +153,9 @@ class _WebpageGeneration(object):
self.existing_metafile = existing_metafile
self.existing_file_kwargs = existing_file_kwargs
self.add_to_existing = add_to_existing
self.analytic_priors = analytic_priors
if self.analytic_priors is None:
self.analytic_priors = {label: None for label in self.samples.keys()}
self.key_data = key_data
if key_data is None:
self.key_data = {
......@@ -992,6 +995,19 @@ class _WebpageGeneration(object):
"provided </p></div>"
)
_fix = True
if i in self.analytic_priors.keys():
if self.analytic_priors[i] is not None:
html_file.make_div(indent=2, _class='paragraph')
html_file.add_content(
"Below is the prior file for %s" % (i)
)
html_file.end_div()
html_file.make_container()
styles = html_file.make_code_block(
language='ini', contents=self.analytic_priors[i]
)
html_file.end_container()
_fix = False
html_file.make_footer(
user=self.user, rundir=self.webdir, fix_bottom=_fix
)
......
......@@ -304,6 +304,9 @@ class page(Base):
elif key == "config":
self.add_content(
"Below is the config file for %s" % (approximant))
elif key == "prior":
self.add_content(
"Below is the prior file for %s" % (approximant))
elif key == "corner":
self.add_content(
"Below is the custom corner plotter for %s" % (approximant))
......
......@@ -119,7 +119,7 @@ class _WebpageGeneration(_CoreWebpageGeneration):
disable_interactive=False, publication_kwargs={}, no_ligo_skymap=False,
psd=None, priors=None, package_information={"packages": []},
mcmc_samples=False, external_hdf5_links=False, preliminary_pages=False,
existing_plot=None, disable_expert=False
existing_plot=None, disable_expert=False, analytic_priors=None
):
self.pepredicates_probs = pepredicates_probs
self.pastro_probs = pastro_probs
......@@ -152,7 +152,8 @@ class _WebpageGeneration(_CoreWebpageGeneration):
disable_interactive=disable_interactive,
package_information=package_information, mcmc_samples=mcmc_samples,
external_hdf5_links=external_hdf5_links, key_data=key_data,
existing_plot=existing_plot, disable_expert=disable_expert
existing_plot=existing_plot, disable_expert=disable_expert,
analytic_priors=analytic_priors
)
if self.file_kwargs is None:
self.file_kwargs = {
......
......@@ -34,7 +34,8 @@ class _PublicWebpageGeneration(_GWWebpageGeneration):
disable_interactive=False, publication_kwargs={}, no_ligo_skymap=False,
psd=None, priors=None, package_information={"packages": []},
mcmc_samples=False, external_hdf5_links=False,
preliminary_pages=False, existing_plot=None, disable_expert=False
preliminary_pages=False, existing_plot=None, disable_expert=False,
analytic_priors=None
):
super(_PublicWebpageGeneration, self).__init__(
webdir=webdir, samples=samples, labels=labels,
......@@ -60,7 +61,7 @@ class _PublicWebpageGeneration(_GWWebpageGeneration):
package_information=package_information,
mcmc_samples=mcmc_samples, external_hdf5_links=external_hdf5_links,
preliminary_pages=preliminary_pages, existing_plot=existing_plot,
disable_expert=disable_expert
disable_expert=disable_expert, analytic_priors=analytic_priors
)
def setup_page(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment