Last modified: December 2013

Jump to: Description · Examples · Bugs · See Also

AHELP for CIAO 4.11 Sherpa v1


Context: methods


Set the value of the specified option for the current iterative fitting method


set_iter_method_opt(option, value)


The set_iter_method_opt command changes the value of the named iterative fitting method option to the specified new value. The full list of customizable options available for the current iterative fitting method is returned by the get_iter_method_opt() command (see "ahelp get_iter_method_opt"). The name of the current iterative fitting method can be printed with the get_iter_method_name command (default is "none"), and the iterative fitting method can be set to "none", "primini", or "sigmarej" with the set_iter_method command (see "ahelp get_iter_method_name" and "ahelp set_iter_method"). The essence of an iterative fitting method is that the chosen fit optimization method can be called several times, until some criterion is met. The fit statistic and optimization methods are selected independently of the iterative fitting method.

If the iterative fitting method is "none" (default), only the name of the current iterative fitting method ("none" in this case) can be altered with the set_iter_method_opt() command (which can be used to change the current iterative fitting method in a roundabout way, i.e., instead of using set_iter_method).

The options which may be edited for Primini's method are:

The options which may be edited for sigma-rejection are:

Note that Primini's method and sigma-rejection can only be called when the fit statistic is a chi-squared statistic; it cannot be used with least-squares, Cash or C-statistic.


Example 1

sherpa> set_stat("chi2datavar")
sherpa> set_method("neldermead")
sherpa> print(get_iter_method_opt())
{'maxiters': 6, 'name': 'primini', 'tol': 0.001}
sherpa> set_iter_method_opt("maxiters", 10)
sherpa> fit()

Print all of the options and associated values of Primini's iterative fitting method before fitting data set 1. Change the maximum number of iterations to be performed in the fit from 6 to 10. Fit data set 1 with this method, so that the Nelder-Mead optimization method will be called until the fit can no longer be improved.

Example 2

sherpa> set_stat("chi2gehrels")
sherpa> set_method("simplex")
sherpa> set_iter_method("sigmarej")
sherpa> print(get_iter_method_opt())
{'lrej': 3, 'maxiters': 5, 'grow': 0, 'name': 'sigmarej', 'hrej': 3}
sherpa> set_iter_method_opt("lrej", 2)
sherpa> print(get_iter_method_opt()["lrej"])
sherpa> fit(2,3)

The sigma-rejection iterative fitting method is used in the simultaneous fitting of data sets 2 and 3. The full list of available options and associated values for this method are returned with get_iter_method_opt(); the low sigma rejection value is changed from 3 to 2 with set_iter_method_opt; and the changed value of 'lrej' is checked with 'get_iter_method_opt()["lrej"]'.


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

See Also

set_conf_opt, set_covar_opt, set_proj_opt
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
get_iter_method_name, get_iter_method_opt, list_iter_methods, set_iter_method, set_method, set_method_opt
get_par, set_bkg_model, set_full_model, set_par, set_pileup_model, set_source, set_xsabund, set_xscosmo, set_xsxsect, set_xsxset
get_stat, set_prior, set_sampler, set_sampler_opt, set_stat
calc_chisqr, calc_stat, set_analysis, set_default_id
contour_resid, image_fit, image_setregion