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

Merge branch 'sampler_saving' into 'master'

Sampler saving

See merge request !494
parents 599fecab 30228db2
No related branches found
No related tags found
1 merge request!494Sampler saving
Pipeline #63984 passed
......@@ -33,7 +33,7 @@ when you change the code your installed version will automatically be updated.
#### Removing previously installed versions
If you have previously installed `bilby` using `pip` (or generally find buggy
behaviour). It may be worthwhile purging your system and reinstalling. To do
behaviour), it may be worthwhile purging your system and reinstalling. To do
this, first find out where the module is being imported from: from any
directory that is *not* the source directory, do the following
......@@ -170,7 +170,7 @@ interested party) please key these three things in mind
* If you open a discussion, be timely in responding to the submitter. Note, the
reverse does not need to apply.
* Keep your questions/comments focussed on the scope of the merge request. If
* Keep your questions/comments focused on the scope of the merge request. If
while reviewing the code you notice other things which could be improved, open
a new issue.
* Be supportive - merge requests represent a lot of hard work and effort and
......
......@@ -169,10 +169,6 @@ def run_sampler(likelihood, priors=None, label='label', outdir='outdir',
else:
result = sampler.run_sampler()
# Initial save of the sampler in case of failure in post-processing
if save:
result.save_to_file(extension=save, gzip=gzip)
end_time = datetime.datetime.now()
result.sampling_time = (end_time - start_time).total_seconds()
logger.info('Sampling time: {}'.format(end_time - start_time))
......@@ -187,10 +183,13 @@ def run_sampler(likelihood, priors=None, label='label', outdir='outdir',
result.log_bayes_factor = \
result.log_evidence - result.log_noise_evidence
if result.injection_parameters is not None:
if conversion_function is not None:
result.injection_parameters = conversion_function(
result.injection_parameters)
# Initial save of the sampler in case of failure in post-processing
if save:
result.save_to_file(extension=save, gzip=gzip)
if None not in [result.injection_parameters, conversion_function]:
result.injection_parameters = conversion_function(
result.injection_parameters)
result.samples_to_posterior(likelihood=likelihood, priors=result.priors,
conversion_function=conversion_function)
......
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