Fit Function¶
FittingFunction Class¶
-
class
eddington.fitting_function_class.FittingFunction(fit_func: Callable, n: int, name: Optional[str], syntax: Optional[str] = None, a_derivative: Optional[Callable] = None, x_derivative: Optional[Callable] = None, save: dataclasses.InitVar = True)¶ Fitting function class.
This class wraps up a callable which gets 2 parameters:
a- An array with the parameters of the function.x- The sample data to be fit.
Our main goal is to find the best suitable
athat match givenxvalues to givenyvalues.Parameters: - fit_func (callable) – The actual fitting function.
- n (int) – Number of parameters. the length of “a” in fit_func.
- name (str) – The name of the function.
- syntax (str) – The syntax of the fitting function
- a_derivative (callable) – a function representing the derivative of fit_func according to the “a” array
- x_derivative – a function representing the derivative of fit_func according to x
- title_name (str) – same as name but in title case
- save (bool) – Should this function be saved in the
FittingFunctionsRegistry
-
active_parameters¶ Number of active parameters (aka, unfixed).
-
assign(a)¶ Assign the function parameters.
-
clear_fixed()¶ Clear all fixed parameters.
Returns: self FittingFunction
-
fix(index, value)¶ Fix parameter with predefined value.
Parameters: - index (int) – The index of the parameter to fix. Starting from 0
- value (float) – The value to fix
Returns: self
FittingFunction
-
unfix(index)¶ Unfix a fixed parameter.
Parameters: index (int) – The index of the parameter to unfix Returns: self FittingFunction
fitting_function decorator¶
-
fitting_function_class.fitting_function(name: Optional[str] = None, syntax: Optional[str] = None, a_derivative: Optional[Callable[[<sphinx.ext.autodoc.importer._MockObject object at 0x7f36c2cd36d0>, Union[<sphinx.ext.autodoc.importer._MockObject object at 0x7f36c2cd3710>, float]], <sphinx.ext.autodoc.importer._MockObject object at 0x7f36c2cd3d10>]] = None, x_derivative: Optional[Callable[[<sphinx.ext.autodoc.importer._MockObject object at 0x7f36c2cdd210>, Union[<sphinx.ext.autodoc.importer._MockObject object at 0x7f36c2cdd250>, float]], Union[<sphinx.ext.autodoc.importer._MockObject object at 0x7f36c2cdd350>, float]]] = None, save: bool = True) → Callable[[Callable[[<sphinx.ext.autodoc.importer._MockObject object at 0x7f36c2cdd510>, Union[<sphinx.ext.autodoc.importer._MockObject object at 0x7f36c2cdd550>, float]], Union[<sphinx.ext.autodoc.importer._MockObject object at 0x7f36c2cdd610>, float]]], eddington.fitting_function_class.FittingFunction]¶ Wrapper making a simple callable into a
FittingFunction.Parameters: - n (int) – Number of parameters. The length of parameter
aof the fitting function. - name (str) – The name of the function.
- syntax (str) – The syntax of the fitting function.
- a_derivative (callable) – a function representing the derivative of the fitting function according to the “a” parameter array
- x_derivative – a function representing the derivative of the fitting function according to x
- save (bool) – Should this function be saved in the
FittingFunctionsRegistry
Returns: FittingFunctioninstance.- n (int) – Number of parameters. The length of parameter