From e9b7b74bd0f159b63dd2606be5055d3f663b25e9 Mon Sep 17 00:00:00 2001 From: Cammille Carinan <cammille.carinan@xfel.eu> Date: Wed, 23 Feb 2022 15:44:46 +0100 Subject: [PATCH] TIL casting list to numpy array returns the sliced view --- src/toolbox_scs/detectors/hrixs.py | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/toolbox_scs/detectors/hrixs.py b/src/toolbox_scs/detectors/hrixs.py index 761ee6e..59d51e2 100644 --- a/src/toolbox_scs/detectors/hrixs.py +++ b/src/toolbox_scs/detectors/hrixs.py @@ -367,21 +367,5 @@ class hRIXS: return (px + mx) / 2, py - my def __add__(self, other): - images = split_images(self.images) + split_images(other.images) - return self.__class__(images=images, + return self.__class__(images=list(self.images) + list(other.images), norm=self.norm + other.norm) - - -def split_images(images): - """ Split the images by the number of trains - and return the list of their views. """ - - # Check if the images has already been splitted - if isinstance(images, list): - return images - - # Check if the images is a numpy of of 2d image that follows - # the shape (num, y_dim, x_dim) - assert len(images.shape) == 3 - - return [np.squeeze(image) for image in np.vsplit(images, images.shape[0])] -- GitLab