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

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


AHELP for CIAO 4.9 Sherpa v1

get_prior

Context: statistics

Synopsis

Access the prior function associated with a Sherpa model parameter.

Syntax

get_prior(par)

Description

The Sherpa prior functions constitute a subset of the pyBLoCXS suite of functions.

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.

By default, pyBLoCXS uses a flat prior defined between the hardcoded parameter minima and maxima. The get_prior() function may be used to access the name of the prior function ('prior') which has been assigned to a thawed fit parameter ('par'), using the set_prior command.

  • par - Sherpa model parameter for which the associated prior function shouldbe returned

The list of currently set prior-parameter pairs is returned by the list_priors command.

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

Example 1

print get_prior(therm.kT)

Access the prior function assigned to the temperature parameter of the Sherpa model 'xsapec.therm'.

sherpa> normgauss1d.g1
sherpa> xsapec.therm
sherpa> g1.pos=2.5; g1.fwhm=0.5
sherpa> set_prior(therm.kT,g1)

sherpa> get_prior(therm.kT)

normgauss1d.g1
   Param        Type          Value          Min          Max      Units
   -----        ----          -----          ---          ---      -----
   g1.fwhm      thawed          0.5  1.17549e-38  3.40282e+38
   g1.pos       thawed          2.5 -3.40282e+38  3.40282e+38
   g1.ampl      thawed            1 -3.40282e+38  3.40282e+38

Example 2

get_prior(abs1.nH)

Access the name of the user-defined function which was asisgned as the prior for the 'nH' parameter of a Sherpa absorption model.

sherpa> def lognorm(x, sigma=0.5, norm=1.0, x0=20.):
   xl=numpy.log10(x)+22.
   return (norm/numpy.sqrt(2*numpy.pi)/sigma)*numpy.exp(-0.5*(xl-x0)*(xl-x0)/sigma/sigma)


sherpa> set_prior(abs1.nH,lognorm)

sherpa> print get_prior(abs1.nH)
<function lognorm at 0xc857230>

Bugs

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

See Also

confidence
get_conf, get_covar, get_int_proj, get_int_unc, get_proj, get_reg_proj, get_reg_unc
contrib
get_chart_spectrum
data
get_areascal, get_arf, get_arf_plot, get_axes, get_backscal, get_bkg, get_bkg_plot, get_bkg_scale, get_coord, get_counts, get_data, get_data_plot, get_dep, get_dims, get_error, get_exposure, get_grouping, get_indep, get_quality, get_rmf, get_specresp, get_staterror, get_syserror
filtering
get_filter
fitting
calc_stat_info, get_fit, get_stat_info
info
get_default_id, list_stats
methods
get_draws, get_iter_method_name, get_iter_method_opt, get_method
modeling
get_model, get_model_component, get_model_component_image, get_model_component_plot, get_model_plot, get_num_par, get_order_plot, get_par, get_pileup_model, get_response, get_source, get_source_component_image, get_source_component_plot, image_source
plotting
get_split_plot
psfs
get_kernel, get_psf
statistics
cash, chi2constvar, chi2datavar, chi2gehrels, chi2modvar, chi2xspecvar, chisquare, cstat, get_chisqr_plot, get_delchi_plot, get_sampler, get_stat, leastsq, list_priors, set_prior, set_sampler, set_stat, wstat
utilities
get_analysis, get_rate
visualization
get_ratio, get_resid, image_getregion

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:   cxchelp@head.cfa.harvard.edu Smithsonian Institution, Copyright © 1998-2017. All rights reserved.