Last modified: December 2013

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


AHELP for CIAO 4.11 Sherpa v1

uniform_sample

Context: modeling

Synopsis

Sample the current set of thawed parameters from a uniform distribution.

Syntax

uniform_sample([num=1, factor=4, id=None, otherids=(), numcores=None])

Description

Sherpa includes several functions for calculating the best set of best-fit model parameters, so to speak, for a given fit of a model to a data set, in order to best determine source flux using that model. This is done by sampling model parameter values, a specified number of times, from a given distribution such as a Gaussian distribution, in order to incorporate the uncertainties on model parameter values in the fit.

The uniform_sample() function returns the fit statistic value per set of thawed model parameters sampled from the standard uniform, continuous distribution. To sample from the Gaussian or Student's t-distribution, use the normal_sample() or t_sample() function.

Arguments:

The uniform_sample() command returns an array table consisting of as many rows as samples taken (determined by the 'num' setting), with the calculated fit statistic values in the first column, and the corresponding sampled model parameters in the subsequent columns.


Examples

Example 1

load_pha("source.pi")
set_source(xsphabs.abs1*powlawd1d.p1)
uniform_sample()
array([[  1.11015721e+02,   4.82266577e-03,   1.86646137e+00,
          1.96840099e-04]])

Call uniform_sample() with default settings to return the fit statistic value and model parameter values resulting from the best fit of an absorbed power-law model to default data set 1, where all thawed parameters are sampled from the standard uniform distribution.

Example 2

uniform_sample(num=50, id=2, numcores=4)
array([[  6.14073018e+01,   3.41972094e-02,   1.73555667e+00,
          1.51382694e-04],
       [  5.14768586e+01,   5.20088098e-03,   1.68554098e+00,
          1.34556679e-04],

         ...

       [  5.53023378e+01,   3.36622190e-02,   2.10473598e+00,
          1.71066495e-04],
       [  3.32604869e+02,   1.11827710e-03,   2.21907598e+00,
          2.32003881e-04]])

Return the fit statistic value and set of model parameter values resulting from the best fit of the model assigned to data set 2, for each of 50 samples drawn from the uniform distribution. Utilize 4 CPUS in the fitting to reduce the computation time.


Bugs

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

See Also

contrib
get_data_prof, get_data_prof_prefs, get_delchi_prof, get_delchi_prof_prefs, get_fit_prof, get_model_prof, get_model_prof_prefs, get_resid_prof, get_resid_prof_prefs, get_source_prof, get_source_prof_prefs, plot_chart_spectrum, plot_marx_spectrum, prof_data, prof_delchi, prof_fit, prof_fit_delchi, prof_fit_resid, prof_model, prof_resid, prof_source
data
get_arf_plot, get_bkg_plot
info
list_model_ids, show_bkg_model, show_bkg_source
modeling
add_model, add_user_pars, clean, create_model_component, delete_bkg_model, delete_model, delete_model_component, get_model, get_model_autoassign_func, 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_source, get_source_component_image, get_source_component_plot, image_model, image_model_component, image_source, image_source_component, integrate, link, load_table_model, load_template_model, load_user_model, normal_sample, reset, save_model, save_source, set_bkg_model, set_full_model, set_model_autoassign_func, set_pileup_model, set_source, set_xsabund, set_xscosmo, set_xsxsect, set_xsxset, t_sample
plotting
get_energy_flux_hist, get_lrt_plot, get_lrt_results, get_photon_flux_hist, get_pvalue_plot, get_pvalue_results, get_split_plot, plot, plot_arf, plot_bkg, plot_cdf, plot_chisqr, plot_data, plot_delchi, plot_energy_flux, plot_fit, plot_model, plot_model_component, plot_order, plot_pdf, plot_photon_flux, plot_pvalue, plot_ratio, plot_resid, plot_scatter, plot_source, plot_source_component, plot_trace, set_xlinear, set_xlog, set_ylinear, set_ylog
psfs
delete_psf, load_conv, plot_kernel
saving
save_delchi, save_resid
statistics
get_chisqr_plot, get_delchi_plot
utilities
calc_chisqr, calc_energy_flux, calc_model_sum, calc_photon_flux, calc_source_sum, calc_stat, eqwidth
visualization
contour_model, contour_ratio, contour_resid, get_ratio, get_resid