Generic fitter
GenericFitter
GenericFitter is a base implementation of a fit function. All fit functions must inherit GenericFitter.
Source code in itfit/fit_functions/common/generic_fitter.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
|
__init__(app, data)
Generic fitter constructor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
app |
Fitter
|
Main application. |
required |
data |
DataSelection
|
Data to fit. |
required |
Source code in itfit/fit_functions/common/generic_fitter.py
delete()
Remove trigger. Used when tool is disabled.
Source code in itfit/fit_functions/common/generic_fitter.py
function(x, *args)
staticmethod
Fit function: f(x,*args)=...
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
float
|
Independent variable. |
required |
*args |
list[float, ...]
|
0, 1 or multiple arguments. |
()
|
Returns:
Type | Description |
---|---|
float
|
|
Source code in itfit/fit_functions/common/generic_fitter.py
get_args()
Return arguments needed for self.function
.
Returns:
Type | Description |
---|---|
Tuple[float]
|
0, 1 or multiple arguments. |
get_args_length()
Gets number of arguments of function
.
Returns:
Type | Description |
---|---|
int
|
Number of arguments of |
gradient(x, *args)
staticmethod
Fit gradient: 'f(x,*args)=...'.
Paremeters
x (float): Independent variable. *args (list[float,...]): 0, 1 or multiple arguments.
Returns:
Type | Description |
---|---|
float
|
'f(x,*args)' |
Source code in itfit/fit_functions/common/generic_fitter.py
on_fit(event)
Event for fit button.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event |
Matplotlib event
|
Not used |
required |
Source code in itfit/fit_functions/common/generic_fitter.py
prop_errors(xdata, self)
Returns the error of the fit, given a gradient.
Returns:
Type | Description |
---|---|
float
|
sigma |
Source code in itfit/fit_functions/common/generic_fitter.py
GenericFitterTool
Bases: ToolToggleBase
Toggles Generic Fitter Tool.
Source code in itfit/fit_functions/common/generic_fitter.py
__init__(*args, app, data, **kwargs)
Creates a GenericFitterTool.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
app |
Fitter
|
Main application. |
required |
data |
DataSelection
|
Data selected. |
required |
Source code in itfit/fit_functions/common/generic_fitter.py
disable(*args)
Triggered when GenericTool is disabled. Removes DragObjects and disables BlitManager.
enable(*args)
Triggered when GenericTool is enabled. Uses BlitManager for faster rendering of DragObjects.