Chandra X-Ray Observatory
	(CXC)
Skip to the navigation links
Last modified: December 2013

URL: http://cxc.harvard.edu/sherpa/ahelp/set_sampler.html
Jump to: Description · Examples · Bugs · See Also


AHELP for CIAO 4.6 Sherpa v2

set_sampler

Context: statistics

Synopsis

Set the current pyBLoCXS sampler.

Syntax

set_sampler(name)

Description

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 set_sampler command may be used to define the current pyBLoCXS sampler (the type of jumping rule to be used in MCMC) to be one of "MH", "MetropolisMH", or "PragBayes".

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.)

  • name - the name of the sampler, or jumping rule to be used in MCMC

Available samplers are returned by the list_samplers command. The configuration options for each pyBLoCXS sampler type may be viewed and customized using the get_sampler command.

Refer to the pyBLoCXS documentation for additional information about the algorithm.

Example 1

sherpa> set_sampler("MetropolisMH")

Set the current MCMC jumping rule to a mix of Metropolis and Metropolis-Hastings.

sherpa> load_pha("pha.fits")
sherpa> set_source(xsphabs.abs1 * powlaw1d.p1)
sherpa> set_stat("cash")
sherpa> fit()
...
sherpa> covar()
...
sherpa> print get_sampler_name()
        MH
sherpa> set_sampler("MetropolisMH")

Example 2

sherpa> set_sampler("MH")

Set the current MCMC jumping rule to Metropolis-Hastings.

sherpa> load_pha("pha.fits")
sherpa> set_source(xsphabs.abs1 * powlaw1d.p1)
sherpa> set_stat("cash")
sherpa> fit()
...
sherpa> covar()
...
sherpa> print get_sampler_name()
        MetropolisMH

sherpa> set_sampler("MH")

Bugs

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

See Also

confidence
set_conf_opt, set_covar_opt, set_proj_opt
data
set_areascal, set_arf, set_backscal, set_bkg, set_coord, set_counts, set_data, set_exposure, set_grouping, set_quality, set_rmf, set_staterror, set_syserror
filtering
set_filter
info
list_stats
methods
set_iter_method, set_iter_method_opt, set_method, set_method_opt
modeling
get_par, set_bkg_model, set_full_model, set_par, set_pileup_model, set_source, set_xsabund, set_xscosmo, set_xsxsect, set_xsxset
statistics
cash, chi2constvar, chi2datavar, chi2gehrels, chi2modvar, chi2xspecvar, chisquare, cstat, get_prior, leastsq, list_priors, set_prior, set_sampler_opt, set_stat
utilities
set_analysis, set_default_id
visualization
image_setregion

Last modified: December 2013
Smithsonian Institute Smithsonian Institute

The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA.   Email:   cxcweb@head.cfa.harvard.edu Smithsonian Institution, Copyright © 1998-2014. All rights reserved.