Skip to content
Snippets Groups Projects
Commit ac2cdaf5 authored by Wolfgang Kastaun's avatar Wolfgang Kastaun
Browse files

Fix bug in shift inversion methods

Convergence criterion was excluding margins even though those points were actually valid.
parent 5ce3bb0c
No related branches found
No related tags found
No related merge requests found
...@@ -76,7 +76,7 @@ class ShiftInverseDask: ...@@ -76,7 +76,7 @@ class ShiftInverseDask:
) )
def f_err(x1: NumpyArray1D, x2: NumpyArray1D) -> float: def f_err(x1: NumpyArray1D, x2: NumpyArray1D) -> float:
return np.max(np.abs(x1 - x2)[self.margin_left : -self.margin_right]) return np.max(np.abs(x1 - x2))
return fixed_point_iter( return fixed_point_iter(
f_iter, f_err, make_numpy_array_1d(dx), tol, self._max_iter f_iter, f_err, make_numpy_array_1d(dx), tol, self._max_iter
......
...@@ -129,7 +129,7 @@ class ShiftInverseNumpy: # pylint: disable=too-few-public-methods ...@@ -129,7 +129,7 @@ class ShiftInverseNumpy: # pylint: disable=too-few-public-methods
return self._interp_np.apply_shift(dx_pad, -x, self.margin_left) return self._interp_np.apply_shift(dx_pad, -x, self.margin_left)
def f_err(x1: NumpyArray1D, x2: NumpyArray1D) -> float: def f_err(x1: NumpyArray1D, x2: NumpyArray1D) -> float:
return np.max(np.abs(x1 - x2)[self.margin_left : -self.margin_right]) return np.max(np.abs(x1 - x2))
shift_idx_inv = fixed_point_iter( shift_idx_inv = fixed_point_iter(
f_iter, f_err, dx, self._tolerance * fsample, self._max_iter f_iter, f_err, dx, self._tolerance * fsample, self._max_iter
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment