set_method_opt

sherpa.astro.ui.set_method_opt(optname: str, val: Any) None

Set an option for the current optimization method.

This is a helper function since the optimization options can also be set directly using the object returned by get_method.

Parameters:
  • optname (str) – The name of the option to set. The get_method and get_method_opt routines 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_method

Return an optimization method.

get_method_opt

Return one or all options of the current optimization method.

set_method

Change the optimization method.

Examples

Change the maxfev parameter for the current optimizer to 2000.

>>> set_method_opt('maxfev', 2000)