diff --git a/src/cal_tools/jungfrau/jungfrau_ff.py b/src/cal_tools/jungfrau/jungfrau_ff.py index 8af48745f100302103c3820b03d7a4dd2630f448..c4f6d33b7854f4d44ee95716da512cb68a2fae11 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]