burstfit.mcmc
MCMC Objects
class MCMC()
Class to run MCMC on the burst model.
Arguments:
model_function
- Function to create the modelsgram
- 2D spectrogram datainitial_guess
- Initial guess of parameters for MCMC (can be a dictionary or list)param_names
- Names of parametersnwalkers
- Number of walkers to use in MCMCnsteps
- Number of iterations to use in MCMCskip
- Number of samples to skip for burn-instart_pos_dev
- Percent deviation for start position of the samplesprior_range
- Percent of initial guess to set as prior rangencores
- Number of CPUs to useoutname
- Name of output filessave_results
- Save MCMC samples to a file
ndim
| @property
| def ndim()
Returns the number of dimensions.
Returns:
number of dimensions
lnprior
| def lnprior(params)
Prior function. Priors are uniform from (1-prior_range)initial_guess to (1+prior_range)initial_guess. Minimum prior for tau is set to 0.
Arguments:
params
- Parameters to check.
Returns:
lnprob
| def lnprob(params)
Log probability function.
Arguments:
params
- Parameters to evaluate at.
Returns:
Prior + log likelihood at the inputs.
lnlk
| def lnlk(inps)
Log likelihood function. Uses the model_function to generate the model.
Arguments:
inps
- Parameters to evaluate at.
Returns:
Log likelihood.
set_initial_pos
| def set_initial_pos()
Function to set the initial values of walkers and prior ranges. Minimum prior for tau is set to 0.
Returns:
set_priors
| def set_priors()
Set priors for MCMC
Returns:
run_mcmc
| def run_mcmc()
Runs the MCMC.
Returns:
Sampler object
get_chain
| def get_chain(skip=None)
Returns the chanins from sampler object after removing some samples for burn-in.
Arguments:
skip
- Number of steps to skip for burn-in.
Returns:
Sample chain.
print_results
| def print_results()
Prints the results of MCMC analysis. It uses median values with 1-sigma errors based on MCMC posteriors.
Returns:
plot
| def plot(save=False)
Plot the samples and corner plot of MCMC posteriors.
Arguments:
save
- To save the corner plot.
Returns:
make_autocorr_plot
| def make_autocorr_plot(save=False)
Make autocorrelation plot for MCMC (i.e autocorrelation time scale vs iteration) see https://emcee.readthedocs.io/en/stable/tutorials/autocorr/
Arguments:
save
- To save the plot
Returns: