@@ -111,9 +111,9 @@ See the following example on how to define these.
111111
112112import lmfit
113113
114- def model(x: float , m : float , c : float ) -> float :
114+ def model(x: float , c1 : float , c0 : float ) -> float :
115115
116- return m * x + c # y = mx + c
116+ return c1 * x + c0 # y = mx + c
117117
118118def guess(x: npt.NDArray[np.float64], y: npt.NDArray[np.float64]) -> dict[str , lmfit.Parameter]:
119119
@@ -125,12 +125,12 @@ def guess(x: npt.NDArray[np.float64], y: npt.NDArray[np.float64]) -> dict[str, l
125125 numerator = sum (x * y) - sum (x) * sum (y)
126126 denominator = sum (x** 2 ) - sum (x) ** 2
127127
128- m = numerator / denominator
129- c = (sum (y) - m * sum (x)) / len (x)
128+ c1 = numerator / denominator
129+ c0 = (sum (y) - c1 * sum (x)) / len (x)
130130
131131 init_guess = {
132- " m " : lmfit.Parameter(" m " , m ), # gradient
133- " c " : lmfit.Parameter(" c " , c ), # y - intercept
132+ " c1 " : lmfit.Parameter(" c1 " , c1 ), # gradient
133+ " c0 " : lmfit.Parameter(" c0 " , c0 ), # y - intercept
134134 }
135135
136136 return init_guess
@@ -155,9 +155,9 @@ This means that aslong as the parameters returned from the guess function match
155155import lmfit
156156from ibex_bluesky_core.callbacks.fitting.fitting_utils import Linear
157157
158- def different_model(x: float , m : float , c : float ) -> float :
158+ def different_model(x: float , c1 : float , c0 : float ) -> float :
159159
160- return m * x + c ** 2 # y = mx + (c ** 2)
160+ return c1 * x + c0 ** 2 # y = mx + (c ** 2)
161161
162162
163163fit_method = FitMethod(different_model, Linear.guess())
@@ -179,8 +179,8 @@ from ibex_bluesky_core.callbacks.fitting.fitting_utils import Linear
179179def different_guess(x: float , m: float , c: float ) -> float :
180180
181181 init_guess = {
182- " m " : lmfit.Parameter(" m " , 1 ), # gradient
183- " c " : lmfit.Parameter(" c " , 0 ), # y - intercept
182+ " c1 " : lmfit.Parameter(" c1 " , 1 ), # gradient
183+ " c0 " : lmfit.Parameter(" c0 " , 0 ), # y - intercept
184184 }
185185
186186 return init_guess
0 commit comments