From 1c12d5d8a174fa70c580bfe4d6e7d42cee263d92 Mon Sep 17 00:00:00 2001 From: Nicola VIGANO Date: Wed, 24 Apr 2024 18:36:30 +0200 Subject: [PATCH] Alignment: added initial support for finer configuration of the cross-correlation functions Signed-off-by: Nicola VIGANO --- src/corrct/alignment/shifts.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/corrct/alignment/shifts.py b/src/corrct/alignment/shifts.py index bd71fd7..2749145 100644 --- a/src/corrct/alignment/shifts.py +++ b/src/corrct/alignment/shifts.py @@ -5,7 +5,8 @@ and ESRF - The European Synchrotron, Grenoble, France """ -from typing import Dict, Optional, Tuple, Union +from collections.abc import Mapping +from typing import Optional, Union import matplotlib.pyplot as plt import numpy as np @@ -490,7 +491,13 @@ def fit_u_360(self) -> float: return float(cor) - def find_shifts_vu(self, data_dvwu: NDArrayFloat, proj_dvwu: NDArrayFloat, use_derivative: bool = False) -> NDArrayFloat: + def find_shifts_vu( + self, + data_dvwu: NDArrayFloat, + proj_dvwu: NDArrayFloat, + use_derivative: bool = False, + xc_opts: Mapping = dict(normalize_fourier=False), + ) -> NDArrayFloat: """Find shifts between two images or sets of lines. Parameters @@ -522,7 +529,7 @@ def find_shifts_vu(self, data_dvwu: NDArrayFloat, proj_dvwu: NDArrayFloat, use_d proj_vwu = np.diff(proj_vwu, axis=-1) # Allow to choose different shift finding functions - shifts_vu = fitting.fit_shifts_vu_xc(data_vwu, proj_vwu, decimals=self.decimals) + shifts_vu = fitting.fit_shifts_vu_xc(data_vwu, proj_vwu, decimals=self.decimals, **xc_opts) # shifts_vu = fitting.fit_shifts_u_sad(data_vwu, proj_vwu, decimals=self.decimals) shifts_vu_all[ii_d] = _filter_shifts(shifts_vu, self.max_shifts)