Fit Data

The fit data returned by calling the fitter is a numpy array. This shape is determined by the frankford.Dataset objects passed. Each element of the array represents one fit and consists of several fields.

Result

The result field is a np.int8 whose value indicates the way that fit algorithm failed or succeeded. Negative values indicate failure while positive values indicate success. It can be interpreted by using it to construct a frankford.Result object.

class frankford.Result(*values)

Represent how a fit terminated.

ERR_UNKNOWN = -1

Unknown error

ERR_DOF = -2

Not enough degrees of freedom

ERR_USER_FUNC = -3

Error from user function

OK_CHI_SQ = 1

Convergence in \(\chi^2\) value

OK_PAR = 2

Convergence in parameter value

OK_BOTH = 3

Both frankford.Result.OK_CHI_SQ and frankford.Result.OK_PAR hold

OK_DIR = 4

Convergence in orthogonality

MAX_ITER = 5

Maximum number of iterations reached

FTOL = 6

frankford.Fitter.ftol is too small - no further improvement

XTOL = 7

frankford.Fitter.xtol is too small - no further improvement

GTOL = 8

frankford.Fitter.gtol is too small - no further improvement

__bool__()

Tell if result is successful.

Note that if result indicates failure of the fit, chi_sq, parameters, uncertainties, and covar are not correct.

Final \(\chi^2\)

The chi_sq field is a np.double whose value indicates the final minimized \(\chi^2\) value of the fit.

Degrees of Freedom

The dof field is a np.int64 whose value indicates the number of degrees of freedom of the fit. It is equal to the number of points used in the fit minus the number of free parameters.

Number of Iterations

The num_iter field is a np.int64 whose value indicates the number of iterations of the Levenberg-Marquardt algorithm used.

Original \(\chi^2\)

The orig_chi_sq field is a np.double whose value indicates the original \(\chi^2\) value of the data using the initial parameter values.

Parameters

The parameters field is a collection of sub-fields of type np.double storing the optimized parameter values. Free parameters are set to the values that minimize \(\chi^2\). Fixed parameters are set to the values provided. Tied parameters are calculated from other parameters.

Uncertainties

The uncertainties field is a collection of sub-fields of type np.double storing the uncertainties of optimized free parameters.

Covariance Matrix

The covar field is a collection of sub-fields of type np.double storing elements of the covariance matrix of free parameters. The names are a combination of the two free parameter names separated by a dollar sign. For example, the covariance of alpha and bravo is alpha$bravo.