Line fitting fails for two data points
mgely opened this issue · 0 comments
mgely commented
The following code fails
from oitg.fitting import line
line.fit([0,1],[0,1])
with error
Traceback (most recent call last):
File "C:\Users\LocalAdmin\Miniconda3\envs\artiq-env\lib\site-packages\oitg-0.1-py3.9.egg\oitg\fitting\FitBase.py", line 249, in fit
File "C:\Users\LocalAdmin\Miniconda3\envs\artiq-env\lib\site-packages\scipy\optimize\minpack.py", line 795, in curve_fit
res = least_squares(func, p0, jac=jac, bounds=bounds, method=method,
File "C:\Users\LocalAdmin\Miniconda3\envs\artiq-env\lib\site-packages\scipy\optimize\_lsq\least_squares.py", line 805, in least_squares
raise ValueError("`x0` is infeasible.")
ValueError: `x0` is infeasible.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "y:/testing/scratch_mfg/line_fit.py", line 2, in <module>
line.fit([0,1],[0,1])
File "C:\Users\LocalAdmin\Miniconda3\envs\artiq-env\lib\site-packages\oitg-0.1-py3.9.egg\oitg\fitting\FitBase.py", line 255, in fit
oitg.fitting.FitBase.FitError: `x0` is infeasible.
One obvious thing that would fail is the parameter_initialiser
in line.py
Lines 6 to 9 in 9b64b4e
which would give division by 0 errors for a size two array.