Fit: Fix index error with curve of 1 point
Closes #2404 (closed)
Here is a MR to fix warning logged by cen
. As Flint compute this state on live, this problem often happens and spam the logs.
This is due to
Traceback (most recent call last):
File "/home/valentin/workspace/bliss.git/bliss/scanning/scan_math.py", line 193, in _capture_exceptions
yield
File "/home/valentin/workspace/bliss.git/bliss/scanning/scan_math.py", line 103, in cen
return _calc_cen(x, y)
File "/home/valentin/workspace/bliss.git/bliss/scanning/scan_math.py", line 451, in _calc_cen
return _cen_from_limits(x, y, y_lim, idx_lim, grad_down)
File "/home/valentin/workspace/bliss.git/bliss/scanning/scan_math.py", line 307, in _cen_from_limits
result = _optimize_limits(x, y, y_lim, idx_lim, grad_down)
File "/home/valentin/workspace/bliss.git/bliss/scanning/scan_math.py", line 266, in _optimize_limits
x_start, x_end = x[idx_lim]
IndexError: index 1 is out of bounds for axis 0 with size 1
I would prefer to rework rework _capture_exceptions
in order to only capture expected exceptions, but for now it's fine.