Parameters
There are three type of parameters that may be used in a fit.
Free Parameters
A free parameter is adjusted by the fitter to minimize \(\chi^2\). It is represented by the class frankford.FreeParameter.
When the fitter is called, a frankford.FreeParameterSetting object must be passed in the dict parameter_settings for each free parameter.
- class frankford.FreeParameterSetting(init_values, *, lower=-inf, upper=inf)
Store information about a free parameter.
- __init__(init_values, *, lower=-inf, upper=inf)
- Parameters:
init_values (np.double | numpy array of np.double) – initial value(s)
lower (np.double | numpy array of np.double) – lower bound(s) for values, defaults to \(-\infty\)
upper (np.double | numpy array of np.double) – upper bound(s) for values, defaults to \(+\infty\)
- property init_values
Initial value(s)
- Return type:
- property lower
Lower bound(s) for values
- Return type:
- property upper
Upper bound(s) for values
- Return type:
- property step
Determines the step side of the finite difference when computing numerical derivatives. Setting this overrides
relative_step.- Type:
- property relative_step
Determines the relative step side of the finite difference when computing numerical derivatives. Setting this overrides
step. Defaults to \(\sqrt{\varepsilon}\) where \(\varepsilon = 2^{-52}\).- Type:
- property side
Determines the sidedness of the finite difference when computing numerical derivatives. Defaults to
frankford.Side.AUTO- Type:
The values for init_values, lower, and upper must each be either a scalar or an array with the same shape as the output array as determined by the datasets.
- class frankford.Side(*values)
Specify the sidedness of the finite difference when computing numerical derivatives.
- AUTO = 0
One-sided derivative with side chosen automatically
- POS = 1
One-sided derivative: \(f^\prime \left( x \right) \approx \frac{f \left(x + h \right) - f \left( x \right)}{h}\)
- NEG = -1
One-sided derivative: \(f^\prime \left( x \right) \approx \frac{f \left(x \right) - f \left( x - h \right)}{h}\)
- BOTH = 2
Two-sided derivative: \(f^\prime \left( x \right) \approx \frac{f \left(x + h \right) - f \left( x - h \right)}{2 h}\)
Fixed Parameters
A fixed parameter is assigned a value that does not change. It is represented by the class frankford.FixedParameter.
When the fitter is called, a frankford.FixedParameterSetting object must be passed in the dict parameter_settings for each fixed parameter.
- class frankford.FixedParameterSetting(values)
Store value(s) of a fixed parameter.
- __init__(values)
- Parameters:
values (np.double | numpy array of np.double) – fixed parameter value(s)
Tied Parameters
A tied parameter has a value that is a function of other parameters. It is represented by the class frankford.TiedParameter.
- class frankford.TiedParameter(function)
Represent a tied parameter.
- __init__(function)
- Parameters:
function (callable) – function that takes other parameters as arguments
- property function
Function
- Return type:
callable
The functions must take only arguments with the same name as other parameters. The function must return a double when all arguments are type double. Further, it must conform to the requirements laid out in the numba documentation for cuda device functions.
If the function raises a python error, the result for the fit is frankford.Result.ERR_USER_FUNC. Returning a non-finite (\(\pm \infty\) or not-a-number (NaN)) value has the same result.
While the function can take one or more other tied parameters as arguments, there may not be a circular dependency. For example, if a is a tied parameter with an argument of b, b is a tied parameter with an argument of c, and c is a tied parameter with an argument of a, an error will be raised.