bilby.core.sampler.run_sampler

bilby.core.sampler.run_sampler(likelihood, priors=None, label='label', outdir='outdir', sampler='dynesty', use_ratio=None, injection_parameters=None, conversion_function=None, plot=False, default_priors_file=None, clean=None, meta_data=None, save=True, gzip=False, result_class=None, npool=1, **kwargs)[source]

The primary interface to easy parameter estimation

Parameters:
likelihood: `bilby.Likelihood`

A Likelihood instance

priors: `bilby.PriorDict`

A PriorDict/dictionary of the priors for each parameter - missing parameters will use default priors, if None, all priors will be default

label: str

Name for the run, used in output files

outdir: str

A string used in defining output files

sampler: str, Sampler

The name of the sampler to use - see bilby.sampler.get_implemented_samplers() for a list of available samplers. Alternatively a Sampler object can be passed

use_ratio: bool (False)

If True, use the likelihood’s log_likelihood_ratio, rather than just the log_likelihood.

injection_parameters: dict

A dictionary of injection parameters used in creating the data (if using simulated data). Appended to the result object and saved.

plot: bool

If true, generate a corner plot and, if applicable diagnostic plots

conversion_function: function, optional

Function to apply to posterior to generate additional parameters.

default_priors_file: str

If given, a file containing the default priors; otherwise defaults to the bilby defaults for a binary black hole.

clean: bool

If given, override the command line interface clean option.

meta_data: dict

If given, adds the key-value pairs to the ‘results’ object before saving. For example, if meta_data={dtype: ‘signal’}. Warning: in case of conflict with keys saved by bilby, the meta_data keys will be overwritten.

save: bool, str

If true, save the priors and results to disk. If hdf5, save as an hdf5 file instead of json. If pickle or pkl, save as an pickle file instead of json.

gzip: bool

If true, and save is true, gzip the saved results file.

result_class: bilby.core.result.Result, or child of

The result class to use. By default, bilby.core.result.Result is used, but objects which inherit from this class can be given providing additional methods.

npool: int

An integer specifying the available CPUs to create pool objects for parallelization.

**kwargs:

All kwargs are passed directly to the samplers run function

Returns:
result: bilby.core.result.Result

An object containing the results