autofit.Emcee#

class autofit.Emcee(name: ~typing.Optional[str] = None, path_prefix: ~typing.Optional[str] = None, unique_tag: ~typing.Optional[str] = None, prior_passer: ~typing.Optional[~autofit.non_linear.abstract_search.PriorPasser] = None, initializer: ~typing.Optional[~autofit.non_linear.initializer.Initializer] = None, auto_correlations_settings=<autofit.non_linear.mcmc.auto_correlations.AutoCorrelationsSettings object>, iterations_per_update: ~typing.Optional[int] = None, number_of_cores: ~typing.Optional[int] = None, session: ~typing.Optional[~sqlalchemy.orm.session.Session] = None, **kwargs)[source]#

Bases: AbstractMCMC

An Emcee non-linear search.

For a full description of Emcee, checkout its Github and readthedocs webpages:

https://github.com/dfm/emcee

https://emcee.readthedocs.io/en/stable/

If you use Emcee as part of a published work, please cite the package following the instructions under the Attribution section of the GitHub page.

Parameters:
  • name – The name of the search, controlling the last folder results are output.

  • path_prefix – The path of folders prefixing the name folder where results are output.

  • unique_tag – The name of a unique tag for this model-fit, which will be given a unique entry in the sqlite database and also acts as the folder after the path prefix and before the search name.

  • prior_passer – Controls how priors are passed from the results of this NonLinearSearch to a subsequent non-linear search.

  • initializer – Generates the initialize samples of non-linear parameter space (see autofit.non_linear.initializer).

  • auto_correlations_settings – Customizes and performs auto correlation calculations performed during and after the search.

  • number_of_cores – The number of cores Emcee sampling is performed using a Python multiprocessing Pool instance. If 1, a pool instance is not created and the job runs in serial.

  • session – An SQLalchemy session instance so the results of the model-fit are written to an SQLite database.

Methods

check_model

config_dict_with_test_mode_settings_from

copy_with_paths

exact_fit

fit

Fit a model, M with some function f that takes instances of the class represented by model M and gives a score for their fitness.

fit_sequential

Fit multiple analyses contained within the analysis sequentially.

fitness_function_from_model_and_analysis

make_pool

Make the pool instance used to parallelize a NonLinearSearch alongside a set of unique ids for every process in the pool.

make_sneaky_pool

Create a pool for multiprocessing that uses slight-of-hand to avoid copying the fitness function between processes multiple times.

optimise

Perform optimisation for expectation propagation.

perform_update

Perform an update of the non-linear search's model-fitting results.

perform_visualization

Perform visualization of the non-linear search's model-fitting results.

plot_results

remove_state_files

samples_from

Attributes

backend

The Emcee hdf5 backend, which provides access to all samples, likelihoods, etc.

backend_filename

config_dict_run

A property that is only computed once per instance and then replaces itself with an ordinary attribute.

config_dict_search

A property that is only computed once per instance and then replaces itself with an ordinary attribute.

config_dict_settings

config_type

logger

Log 'msg % args' with severity 'DEBUG'.

name

paths

samples_cls

timer

property backend: HDFBackend#

The Emcee hdf5 backend, which provides access to all samples, likelihoods, etc. of the non-linear search.

The sampler is described in the “Results” section at https://dynesty.readthedocs.io/en/latest/quickstart.html