From a2f7c7af5cc17951309cab574d193e2ed0a28fc1 Mon Sep 17 00:00:00 2001 From: James Fuller Date: Fri, 14 Aug 2026 12:14:00 -0500 Subject: [PATCH] fix: make patch motion groups the sum of the underlying frames --- src/motioncorr_runner.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/motioncorr_runner.cpp b/src/motioncorr_runner.cpp index fa79070a0..f9d4fddad 100644 --- a/src/motioncorr_runner.cpp +++ b/src/motioncorr_runner.cpp @@ -1572,11 +1572,12 @@ bool MotioncorrRunner::executeOwnMotionCorrection(Micrograph &mic) { for (int igroup = 0; igroup < n_groups; igroup++) { const int tid = omp_get_thread_num(); Ipatches[tid].reshape(y_end - y_start, x_end - x_start); // end is not included + Ipatches[tid].initZeros(); RCTIC(TIMING_CLIP_PATCH); for (int iframe = group_start[igroup]; iframe < group_start[igroup] + group_size[igroup]; iframe++) { for (int ipy = y_start; ipy < y_end; ipy++) { for (int ipx = x_start; ipx < x_end; ipx++) { - DIRECT_A2D_ELEM(Ipatches[tid], ipy - y_start, ipx - x_start) = DIRECT_A2D_ELEM(Iframes[iframe](), ipy, ipx); + DIRECT_A2D_ELEM(Ipatches[tid], ipy - y_start, ipx - x_start) += DIRECT_A2D_ELEM(Iframes[iframe](), ipy, ipx); } } }