Skip to content

Commit c968cd1

Browse files
committed
Fix typing annotations for autofit methods
1 parent a8cdc64 commit c968cd1

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

plotpy/tests/features/test_fit.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ def fit(x, params):
2121
a, b = params
2222
return np.cos(b * x) + a
2323

24-
a = FitParam("Offset", 1.0, 0.0, 2.0)
25-
b = FitParam("Frequency", 2.0, 1.0, 10.0, logscale=True)
24+
a = FitParam("Offset", 0.7, -1.0, 1.0)
25+
b = FitParam("Frequency", 1.2, 0.3, 3.0, logscale=True)
2626
params = [a, b]
2727
values = guifit(x, y, fit, params, xlabel="Time (s)", ylabel="Power (a.u.)")
2828

plotpy/widgets/fit.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class AutoFitParam(DataSet):
100100
err_norm = StringItem(
101101
"enorm",
102102
default=2.0,
103-
help=_("for simplex, powel, cg and bfgs norm used " "by the error function"),
103+
help=_("for simplex, powel, cg and bfgs norm used by the error function"),
104104
)
105105
xtol = FloatItem(
106106
"xtol", default=0.0001, help=_("for simplex, powel, least squares")
@@ -724,7 +724,7 @@ def func(params):
724724

725725
return func
726726

727-
def autofit_simplex(self, x0: float) -> np.ndarray:
727+
def autofit_simplex(self, x0: np.ndarray) -> np.ndarray:
728728
"""Autofit using simplex
729729
730730
Args:
@@ -738,7 +738,7 @@ def autofit_simplex(self, x0: float) -> np.ndarray:
738738
x = fmin(self.get_norm_func(), x0, xtol=prm.xtol, ftol=prm.ftol)
739739
return x
740740

741-
def autofit_powel(self, x0: float) -> np.ndarray:
741+
def autofit_powel(self, x0: np.ndarray) -> np.ndarray:
742742
"""Autofit using Powell
743743
744744
Args:
@@ -752,7 +752,7 @@ def autofit_powel(self, x0: float) -> np.ndarray:
752752
x = fmin_powell(self.get_norm_func(), x0, xtol=prm.xtol, ftol=prm.ftol)
753753
return x
754754

755-
def autofit_bfgs(self, x0: float) -> np.ndarray:
755+
def autofit_bfgs(self, x0: np.ndarray) -> np.ndarray:
756756
"""Autofit using BFGS
757757
758758
Args:
@@ -766,7 +766,7 @@ def autofit_bfgs(self, x0: float) -> np.ndarray:
766766
x = fmin_bfgs(self.get_norm_func(), x0, gtol=prm.gtol, norm=eval(prm.norm))
767767
return x
768768

769-
def autofit_l_bfgs(self, x0: float) -> np.ndarray:
769+
def autofit_l_bfgs(self, x0: np.ndarray) -> np.ndarray:
770770
"""Autofit using L-BFGS-B
771771
772772
Args:
@@ -783,7 +783,7 @@ def autofit_l_bfgs(self, x0: float) -> np.ndarray:
783783
)
784784
return x
785785

786-
def autofit_cg(self, x0: float) -> np.ndarray:
786+
def autofit_cg(self, x0: np.ndarray) -> np.ndarray:
787787
"""Autofit using conjugate gradient
788788
789789
Args:
@@ -797,7 +797,7 @@ def autofit_cg(self, x0: float) -> np.ndarray:
797797
x = fmin_cg(self.get_norm_func(), x0, gtol=prm.gtol, norm=eval(prm.norm))
798798
return x
799799

800-
def autofit_lq(self, x0: float) -> np.ndarray:
800+
def autofit_lq(self, x0: np.ndarray) -> np.ndarray:
801801
"""Autofit using leastsq
802802
803803
Args:

0 commit comments

Comments
 (0)