Commit da83283a authored by Gregory Ashton's avatar Gregory Ashton
Browse files

Minor rewrite to functino conv. samples to posterior

- Renames the functin to show it is the `posterior` attribute which is
parent f4c2db34
......@@ -189,9 +189,10 @@ class Result(dict):
logging.warning("plot_distributions deprecated")
def samples_to_data_frame(self, likelihood=None, priors=None, conversion_function=None):
def samples_to_posterior(self, likelihood=None, priors=None,
Convert array of samples to data frame.
Convert array of samples to posterior (a Pandas data frame).
......@@ -203,7 +204,8 @@ class Result(dict):
Function which adds in extra parameters to the data frame,
should take the data_frame, likelihood and prior as arguments.
data_frame = pd.DataFrame(self.samples, columns=self.search_parameter_keys)
data_frame = pd.DataFrame(
self.samples, columns=self.search_parameter_keys)
if conversion_function is not None:
conversion_function(data_frame, likelihood, priors)
self.posterior = data_frame
......@@ -524,7 +524,8 @@ def run_sampler(likelihood, priors=None, label='label', outdir='outdir',
result.fixed_parameter_keys = sampler.fixed_parameter_keys
# result.prior = prior # Removed as this breaks the saving of the data
result.samples_to_data_frame(likelihood=likelihood, priors=priors, conversion_function=conversion_function)
result.samples_to_posterior(likelihood=likelihood, priors=priors,
result.kwargs = sampler.kwargs
if plot:
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