From 328d0bc8a506efbf7d51e0016aba66bd873aa667 Mon Sep 17 00:00:00 2001 From: Philipp Schmidt <philipp.schmidt@xfel.eu> Date: Tue, 19 Oct 2021 11:41:42 +0200 Subject: [PATCH] Check source and destination shape in agipdalgs.transpose_constant --- src/cal_tools/agipdalgs.pyx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cal_tools/agipdalgs.pyx b/src/cal_tools/agipdalgs.pyx index 8100ec9f5..954d63d70 100644 --- a/src/cal_tools/agipdalgs.pyx +++ b/src/cal_tools/agipdalgs.pyx @@ -33,6 +33,11 @@ def transpose_constant(outp_t[:, :, :, ::contiguous] dst, to be fast for AGIPD constants. """ + if not (dst.shape[0] == src.shape[3] and dst.shape[1] == src.shape[2] and + dst.shape[2] == src.shape[1] and dst.shape[3] == src.shape[0]): + raise ValueError(f'dst shape {np.array(dst.shape)[:4]} must be ' + f'reversed src shape {np.array(src.shape)[:4]}') + cdef int y, x, c, g # Optimized iteration (on INTEL) order via profiling, do not change -- GitLab