MCMC Fitting

radvel.mcmc.convergence_check(samplers, maxGR, minTz, minsteps)[source]

Check for convergence Check for convergence for a list of emcee samplers

Parameters:
  • samplers (list) – List of emcee sampler objects
  • maxGR (float) – Maximum G-R statistic for chains to be deemed well-mixed and halt the MCMC run
  • minTz (int) – Minimum Tz to consider well-mixed
  • minsteps (int) – Minimum number of steps per walker before convergence tests are performed
radvel.mcmc.draw_models_from_chain(mod, chain, t, nsamples=50)[source]

Draw Models from Chain

Given an MCMC chain of parameters, draw representative parameters and synthesize models. :param mod: RV model :type mod: radvel.RVmodel :param chain: pandas DataFrame with different values from MCMC

chain
Parameters:
  • t (array) – time range over which to synthesize models
  • nsamples (int) – number of draws
Returns:

2D array with the different models as different rows

Return type:

array

radvel.mcmc.gelman_rubin(pars0, minTz, maxGR)[source]

Gelman-Rubin Statistic Calculates the Gelman-Rubin statistic and the number of independent draws for each parameter, as defined by Ford et al. (2006) (http://adsabs.harvard.edu/abs/2006ApJ…642..505F). The chain is considered well-mixed if all parameters have a Gelman-Rubin statistic of <= 1.03 and >= 1000 independent draws. History:

2010/03/01 - Written: Jason Eastman - The Ohio State University 2012/10/08 - Ported to Python by BJ Fulton - University of Hawaii,

Institute for Astronomy

2016/04/20 - Adapted for use in radvel. Removed “angular” parameter.

Parameters:
  • pars0 (array) – A 3 dimensional array (NPARS,NSTEPS,NCHAINS) of parameter values
  • minTz (int) – minimum Tz to consider well-mixed
  • maxGR (float) – maximum Gelman-Rubin statistic to consider well-mixed
Returns:

tuple containing:

ismixed (bool): Are the chains well-mixed? gelmanrubin (array): An NPARS element array containing the

Gelman-Rubin statistic for each parameter (equation 25)

Tz (array): An NPARS element array containing the number

of independent draws for each parameter (equation 26)

Return type:

(tuple)

radvel.mcmc.mcmc(post, nwalkers=50, nrun=10000, ensembles=8, checkinterval=50, burnGR=1.03, maxGR=1.01, minTz=1000, minsteps=1000)[source]

Run MCMC Run MCMC chains using the emcee EnsambleSampler :param post: radvel posterior object :type post: radvel.posterior :param nwalkers: (optional) number of MCMC walkers :type nwalkers: int :param nrun: (optional) number of steps to take :type nrun: int :param ensembles: (optional) number of ensembles to run. Will be run

in parallel on separate CPUs
Parameters:
  • checkinterval (int) – (optional) check MCMC convergence statistics every checkinterval steps
  • burnGR (float) – (optional) Maximum G-R statistic to stop burn-in period
  • maxGR (float) – (optional) Maximum G-R statistic for chains to be deemed well-mixed and halt the MCMC run
  • minTz (int) – (optional) Minimum Tz to consider well-mixed
  • minsteps (int) – (optional) Minimum number of steps per walker before convergence tests are performed
Returns:

DataFrame containing the MCMC samples

Return type:

DataFrame