From 5d0c0fa5af7aa90d318e0eceb4e0c4a60885a7e1 Mon Sep 17 00:00:00 2001 From: Thomas Kluyver <thomas.kluyver@xfel.eu> Date: Mon, 9 Dec 2024 11:00:21 +0100 Subject: [PATCH] Apply suggestions from review --- src/cal_tools/jungfrau/jungfrau_ff.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cal_tools/jungfrau/jungfrau_ff.py b/src/cal_tools/jungfrau/jungfrau_ff.py index 8af48745f..c4f6d33b7 100644 --- a/src/cal_tools/jungfrau/jungfrau_ff.py +++ b/src/cal_tools/jungfrau/jungfrau_ff.py @@ -68,8 +68,8 @@ def chunk_multi(data, block_size): for j in range(0, cols, chunk_cols): chunk = data[ ..., - i:min(i+chunk_rows, rows), - j:min(j+chunk_cols, cols) + i: i+chunk_rows, + j: j+chunk_cols ] chunks.append(chunk) @@ -96,7 +96,7 @@ def fill_histogram(image_data, histogram_bins): if not isinstance(image_data, np.ndarray): raise TypeError("Expected imgs numpy ndarray type.") - if image_data.ndim < 4: + if image_data.ndim != 4: raise ValueError("Expected 4D imgs array.") n_cells, n_rows, n_cols = image_data.shape[1:] @@ -218,7 +218,7 @@ def rebin_histo(hist, bin_centers, rebin_factor): x_out = bin_centers[::rebin_factor] h_out = np.sum( - hist[:len(hist) - (len(hist) % rebin_factor)].reshape(-1, rebin_factor), # noqa + hist.reshape(-1, rebin_factor), axis=1, ) x_out = bin_centers[::rebin_factor] -- GitLab