sfit_minimizer.sfit_minimize module

sfit_minimizer.sfit_minimize.set_initial_step_size(options)

Set the step size for the minimize() function.

Arguments:
options: dict

To specify the step, set options[‘step’] = float. The parameter values will be iterated by this value * the calculated step size. Alternatively, options[‘step’] = ‘adaptive’ will start with a default size of 0.01. If None or ‘step’ not in options, uses a default step size of 0.1.

Returns:
fac: float

The initial fraction of the step that will be added in each iteration of the minimize() routine.

sfit_minimizer.sfit_minimize.minimize(sfit_obj, x0=None, tol=0.001, options=None, max_iter=1000, verbose=False)

Find the best-fit parameters for a function f using A. Gould’s sfit algorithm.

Arguments:
sfit_obj: sfit_minimizer.sfit_classes.SFitFunction

The function whose parameters are being fit.

Keywords:
x0: list, or list-like

Initial guess for the values of the parameters

tol: float

Chi2 tolerance; i.e., when chi2_old - chi2_new < tol, stop.

options: dict

options for the minimizer. Currently available: ‘step’ (see set_initial_step_size())

max_iter: int

Maximum number of iterations.

verbose: bool

True = print results of each iteration to the screen.

Returns:

sfit_minimizer.sfit_classes.SFitResults object.