OptMethod

class sherpa.optmethods.OptMethod(name, optfunc)[source]

Bases: sherpa.utils.NoNewAttributesAfterInit

Base class for the optimisers.

Parameters:
  • name (str) – The name of the optimiser.
  • optfunc (function) – The function which optimises the model: its arguments are a function which evalutes the statistic given a list of parameter values, the starting parameters, minima, and maxima, followed by keyword arguments matching the configuration data.

Attributes Summary

default_config The default settings for the optimiser.

Methods Summary

fit(statfunc, pars, parmins, parmaxes[, …]) Run the optimiser.

Attributes Documentation

default_config

The default settings for the optimiser.

Methods Documentation

fit(statfunc, pars, parmins, parmaxes, statargs=(), statkwargs={})[source]

Run the optimiser.

Parameters:
  • statfunc (function) – Given a list of parameter values as the first argument and, as the remaining positional arguments, statargs and statkwargs as keyword arguments, return the statistic value.
  • pars (sequence) – The start position of the model parameter values.
  • parmins (sequence) – The minimum allowed values for each model parameter. This must match the length of pars.
  • parmaxes (sequence) – The maximum allowed values for each model parameter. This must match the length of pars.
  • statargs (optional) – Additional positional arguments to send to statfunc.
  • statkwargs (optional) – Additional keyword arguments to send to statfunc.
Returns:

newpars – The model parameters after the optimiser has run.

Return type:

tuple