pyemcee.main package¶
pyemcee main module¶
This module contains functions for the affine-invariant Markov chain Monte Carlo (MCMC) ensemble sampler proposed by Goodman & Weare (2010).
-
pyemcee.
find_errors
(output, mcmc_sim, clevel, do_plot=None, image_output_path=None)[source]¶ This function returns the uncertainties of the function outputs based on the confidence level.
For example:
>> output_error=pyemcee.find_erros(output, mcmc_sim, clevel)
- Returns
This function returns uncertainties.
- Return type
arrays
- Parameters
do_plot (boolean) – set to plot a normalized histogram of the MCMC chain.
image_output_path (str) – the image output path.
output (arrays) – the output array returned by the calling function.
mcmc_sim (arrays) – the results of the MCMC simulations from hammer().
clevel (float) – the confidence level for the the lower and upper limits. clevel=0.38292492 (0.5-sigma); clevel=0.68268949 (1.0-sigma); clevel=0.86638560 (1.5-sigma); clevel=0.90 (1.645-sigma); clevel=0.95 (1.960-sigma); clevel=0.95449974 (2.0-sigma); clevel=0.98758067 (2.5-sigma); clevel=0.99 (2.575-sigma); clevel=0.99730020 (3.0-sigma); clevel=0.99953474 (3.5-sigma); clevel=0.99993666 (4.0-sigma); clevel=0.99999320 (4.5-sigma); clevel=0.99999943 (5.0-sigma); clevel=0.99999996 (5.5-sigma); clevel=0.999999998(6.0-sigma).
-
pyemcee.
hammer
(fcn, input, input_err_m, input_err_p, output, walk_num, iteration_num, use_gaussian, functargs=None)[source]¶ This function runs the affine-invariant MCMC Hammer, and returns the MCMC simulations
For example:
>> mcmc_sim=pyemcee.hammer(myfunc, input, input_err, output, >> walk_num, iteration_num, use_gaussian)
- Returns
This function returns the results of the MCMC simulations.
- Return type
arrays
- Parameters
functargs (parameter, optional) – the function arguments (not used for MCMC).
fcn (str) – the calling function name.
input (float) – the input parameters array used by the calling function.
input_err_m (float) – the lower limit uncertainty array of the parameters for the calling function.
input_err_p (float) – the upper limit uncertainty array of the parameters for the calling function.
output (arrays) – the output array returned by the calling function.
walk_num (int) – the number of the random walkers.
iteration_num (int) – the number of the MCMC iteration.
use_gaussian (boolean) – if sets to 1, the walkers are initialized as a gaussian over the specified range between the min and max values of each free parameter, otherwise, the walkers are initialized uniformly over the specified range between the min and max values of each free parameter.