set_iter_method_opt

sherpa.astro.ui.set_iter_method_opt(optname, val)

Set an option for the iterative-fitting scheme.

Parameters:
  • optname (str) – The name of the option to set. The get_iter_method_opt routine can be used to find out valid values for this argument.
  • val – The new value for the option.
Raises:

sherpa.utils.err.ArgumentErr – If the optname argument is not recognized.

See also

get_iter_method_name()
Return the name of the iterative fitting scheme.
get_iter_method_opt()
Return one or all options for the iterative-fitting scheme.
list_iter_methods()
List the iterative fitting schemes.
set_iter_method()
Set the iterative-fitting scheme used in the fit.

Notes

The supported fields for the primini scheme are:

maxiters
The maximum number of iterations to perform.
tol
The iteration stops when the change in the best-fit statistic varies by less than this value.

The supported fields for the sigmarej scheme are:

grow
The number of points adjacent to a rejected point that should also be removed. A value of 0 means that only the discrepant point is removed whereas a value of 1 means that the two adjacent points (one lower and one higher) will also be removed.
hrej
The rejection criterion in units of sigma, for data points above the model (it must be >= 0).
lrej
The rejection criterion in units of sigma, for data points below the model (it must be >= 0).
maxiters
The maximum number of iterations to perform. If this value is 0 then the fit will run until it has converged.

Examples

Reject any points that are more than 5 sigma away from the best fit model and re-fit.

>>> set_iter_method('sigmarej')
>>> set_iter_method_opt('lrej', 5)
>>> set_iter_method_opt('hrej', 5)
>>> fit()