Chandra X-Ray Observatory
Skip to the navigation links
Last modified: December 2010

Jump to: Description · Examples · Bugs · See Also

AHELP for CIAO 4.3 Sherpa v1


Context: methods


Set the iterative fitting method




The set_iter_method command is used to set the current iterative fitting method to either "none" (default), "primini", or "sigmarej". All available iterative fitting methods are returned by the list_iter_methods command, and the name of the current iterative fitting method is returned by the get_iter_method_name command. 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.

  • name = name of an iterative fitting method, either "none" (default), "primini", or "sigmarej"

If the iterative fitting method is "none", then no iterative fitting is done when "fit()" is called; the optimization method is called once, and Sherpa otherwise operates as expected.

Primini's method is used for re-calculating statistical errors using the best-fit model parameters from the *previous* fit, until the fit can no longer be improved.

The sigma-rejection method is based on the IRAF SFIT function. In successive fits, data points for which ((data - model) / error) exceeds some threshold are added to the filter, and automatically excluded from the next fit.

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_name())
sherpa> set_iter_method("primini")
sherpa> fit()

Primini's method is set as the iterative fitting method for fitting data set 1. When "fit()" is run, the Nelder-Mead optimization method is called until the fit can no longer be improved.

Example 2

sherpa> set_stat("chi2xspecvar")
sherpa> set_method("levmar")
sherpa> print(get_iter_method_name())
sherpa> set_iter_method("none")
sherpa> fit(2)

Data set 2 is to be fit without iterative fitting, therefore the current iterative fitting method is changed from "primini" to "none". The Levenberg-Marquardt optimization method is called once during the fit to data set 2.

Example 3

sherpa> set_stat("chi2gehrels")
sherpa> set_method("simplex")
sherpa> set_iter_method("sigmarej")
sherpa> fit(2,3)

The sigma-rejection iterative fitting method is used in the simultaneous fitting of data sets 2 and 3. When "fit(2,3)" is run, the Nelder-Mead optimization method is called until the fit can no longer be improved.


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_opt, 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_stat
calc_chisqr, calc_stat, set_analysis, set_default_id
contour_resid, image_fit, image_setregion

Last modified: December 2010
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: Smithsonian Institution, Copyright © 1998-2019. All rights reserved.