Commit 3dc3d20c authored by Nicola Vigano's avatar Nicola Vigano
Browse files

Alignment: added equispaced translation images self detection



Signed-off-by: Nicola Vigano's avatarNicola VIGANÒ <nicola.vigano@esrf.fr>
parent 8f6ed14a
Pipeline #27661 passed with stages
in 2 minutes and 36 seconds
......@@ -489,6 +489,27 @@ class DetectorTranslationAlongBeam(AlignmentBase):
% (" ".join(("%d" % x for x in shape_stack)), " ".join(("%d" % x for x in shape_pos)),)
)
@staticmethod
def _check_equispaced(img_pos, supposed_equispaced):
img_pos_incrs = np.diff(img_pos)
detected_equispaced = np.all(np.isclose(img_pos_incrs[0], img_pos_incrs[1:]))
if detected_equispaced and not supposed_equispaced:
logging.getLogger(__name__).warning(
"The image position increments were supposed to NOT be equispaced, " +
"but they seem to be equispaced: " +
" ".join(("%f" % x for x in img_pos)) +
". Forcing behavior according to the detected condition."
)
if not detected_equispaced and supposed_equispaced:
logging.getLogger(__name__).warning(
"The image position increments were supposed to be equispaced, " +
"but they seem to NOT be equispaced: " +
" ".join(("%f" % x for x in img_pos)) +
". Forcing behavior according to the detected condition."
)
return detected_equispaced
def find_shift(
self,
img_stack: np.ndarray,
......@@ -497,7 +518,7 @@ class DetectorTranslationAlongBeam(AlignmentBase):
median_filt_shape=None,
padding_mode=None,
peak_fit_radius=1,
equispaced_increments=False
equispaced_increments=True
):
"""Find the deviation of the translation axis of the area detector
along the beam propagation direction.
......@@ -552,6 +573,7 @@ class DetectorTranslationAlongBeam(AlignmentBase):
TODO: Add examples here!
"""
self._check_img_sizes(img_stack, img_pos)
equispaced_increments = self._check_equispaced(img_pos, equispaced_increments)
if peak_fit_radius < 1:
logging.getLogger(__name__).warning(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment