Last modified: December 2023

Jump to: Description ยท Bugs

AHELP for CIAO 4.16 Sherpa


Context: methods


MCMC-based algorithm for Bayesian Low-Count X-ray Spectral (BLoCXS) analysis


pyBLoCXS is a sophisticated Markov chain Monte Carlo (MCMC) based algorithm designed to carry out Bayesian Low-Count X-ray Spectral (BLoCXS) analysis in the Sherpa environment. The algorithm explores parameter space at a suspected minimum - i.e. after a standard Sherpa fit.

The Sherpa get_draws() command runs a pyBLoCXS chain using fit information associated with the specified data set(s), and the currently set sampler and parameter priors, for a specified number of iterations. It returns an array of statistic values, an array of acceptance Booleans, and a 2-D array of associated parameter values.

The sampler, or jumping rule, to be used by pyBLoCXS may be set with set_sampler, and its configuration options modifed using the set_sampler_opt command. The available samplers are returned by the list_samplers command.

Jumping Rules

"MH" is Metropolis-Hastings, which always jumps from the best-fit, and "MetropolisMH" is Metropolis with Metropolis-Hastings that jumps from the best-fit with probability 'p_M', else it jumps from the last accepted jump. "PragBayes" is used when effective area calibration uncertainty is to be included in the calculation. (At each nominal MCMC iteration, a new calibration product is generated, and a series of N (option in set_sampler_opt) MCMC sub-iteration steps are carried out, choosing between Metropolis and Metropolis-Hastings types of samplers with probability p_M (option in set_sampler_opt). Only the last of these sub-iterations are kept in the chain.)

By default, pyBLoCXS uses a flat prior defined between the hardcoded parameter minima and maxima. The set_prior() command is used to associate a function or model ('prior') with a thawed fit parameter ('par'). The list of currently set prior-parameter pairs is returned by list_priors(); and the prior function associated with a particular Sherpa model parameter may be accessed with get_prior().

Refer to the sherpa.sim module documentation for additional information about the algorithm.


See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.