AHELP for CIAO 4.11 Sherpa v1

t_sample

Context: modeling

Synopsis

Sample the current set of thawed parameters from a Student's t-distribution.

Syntax

`t_sample([num=1, dof=None, 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 t_sample() function returns the fit statistic value per set of thawed model parameters sampled from the Student's t-distribution. To sample from the Gaussian or uniform distribution, use the normal_sample() or uniform_sample() function.

Arguments:

• num - number of samples to calculate; default = 1
• dof - number of degrees of freedom, calculated from current fit by default; default = None
• id - Sherpa data id; default = default data id
• otherids - list of other Sherpa data ids; default = ()
• numcores - number of CPUs to use to calculate the statistic; default = number of detected CPUs

The t_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)
t_sample()```
```array([[  7.42052409e+01,   2.19304497e-02,   2.07296817e+00,
1.97260260e-04]])
```

Call t_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 Student's t-distribution.

Example 2

`t_sample(num=200, id=4, numcores=3)`
```array([[  3.67613474e+01,   2.02327747e-02,   1.94780376e+00,
1.97563375e-04],
[  3.67961761e+01,   1.76162104e-02,   1.94484171e+00,
1.74684117e-04],

...

[  3.52175590e+01,   1.78847675e-02,   1.99037247e+00,
1.86183040e-04],
[  3.54881367e+01,   1.49198878e-02,   2.00103062e+00,
1.87970536e-04]])
```

Return the fit statistic value and set of model parameter values resulting from the best fit of the model assigned to data set 4, for each of 200 samples drawn from the t-distribution. Utilize 2 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.

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, uniform_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