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 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.

  • option - the name of the iterative fitting option to be changed
  • value - the new value for the iterative fitting option

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:

  • maxiters - maximum number of iterations to perform, even if the fit statistic has not converged
  • name - name of the current iterative fitting method
  • tol - the iterative fitting is stopped when the statistic varies by less than the tolerance value between iterations.

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

  • lrej - data point rejection criterion in units of sigma, for data points below the model
  • maxiters - maximum number of iterations to perform in the fit (if 0, the fit will run to convergence, i.e., until there is no change in the filter)
  • grow - rejection growing radius (when a given data point is to be filtered out, this parameter sets the number of pixels adjacent to that pixel which are also to be filtered out; i.e., if 0, only the data point itself is filtered out; if 1, the data point and its two immediate neighbors are filtered out, and so on)
  • name - name of the current iterative fitting method
  • hrej - data point rejection criterion in units of sigma, for data points above the model

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_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.