Overview
This document assumes that the user is familiar with the numpy package and the Levenberg-Marquardt Algorithm.
Summary
The user provides one or more functions (models) and corresponding datasets to be fitted by their model by adjusting specified parameters to minimize the total \(\chi^2\) across all datasets.
A dataset consists of a multi-dimensional array of dependant values along with their uncertainties and one or more sets of independent variables. Each model is a function of the independent variables and some or all of the parameters. Each sub-array along the specified axes is independently fit by adjusting parameters.
A fit is optimized if the results of the model functions most closely match the dependant values provided. This produces an output array of fits. Each fit specifies the optimal parameter values and other information.
Fitter Class
The frankford.Fitter class is used in two steps:
The initializer is passed information about the parameters to be used in the fits and the model(s) (function(s)) that will be fitted to the data. This method creates the GPU code and loads it into the current context.
The fitter object is called with data about free parameters and datasets. This actually runs the code on the GPU and returns fit data. The fit data that is returned contains the optimal parameter values and other information.
- class frankford.Fitter(parameters, models)
Represent a fit set.
- __init__(parameters, models)
Setup an array of fits.
- Parameters:
parameters (dict of str to (
frankford.FreeParameter|frankford.FixedParameter|frankford.TiedParameter)) – Parameters to be passed to modelsmodels (dict of Any to callable) – functions to fit to datasets
- __call__(parameter_settings, datasets, *, returned_parameters=None, returned_uncertainties=(), returned_covar=(), block_size=256)
Execute an array of fits on the GPU and return the output array.
- Parameters:
parameter_settings (dict of str to (
frankford.FreeParameterSetting|frankford.FixedParameterSetting)) – settings for free and fixed parametersreturned_parameters (None | list of str, optional) – list of parameters to return, defaults to returning all parameters.
returned_uncertainties (list of str, optional) – list of parameter uncertainties to return, defaults to []
returned_covar (list of (str, str), optional) – list of parameter covariances to return, defaults to []
block_size (int, optional) – number of threads per block on GPU, defaults to 256
- property ftol
Relative chi-square convergence criterium
- Return type:
np.double
- property xtol
Relative parameter convergence criterium
- Return type:
np.double
- property gtol
Orthogonality convergence criterium
- Return type:
np.double
- property stepfactor
Initial step bound
- Return type:
np.double
- property covtol
Range tolerance for covariance calculation
- Return type:
np.double
- property maxiter
Maximum number of iterations
- Return type:
np.int64
- property parameters
Loaded parameter
- Return type:
dict of str to (
frankford.FreeParameter|frankford.FixedParameter|frankford.TiedParameter)