Skip to content
Snippets Groups Projects
Commit e9b7b74b authored by Cammille Carinan's avatar Cammille Carinan
Browse files

TIL casting list to numpy array returns the sliced view

parent 8b40f020
No related branches found
No related tags found
1 merge request!170hRIXS functions
...@@ -367,21 +367,5 @@ class hRIXS: ...@@ -367,21 +367,5 @@ class hRIXS:
return (px + mx) / 2, py - my return (px + mx) / 2, py - my
def __add__(self, other): def __add__(self, other):
images = split_images(self.images) + split_images(other.images) return self.__class__(images=list(self.images) + list(other.images),
return self.__class__(images=images,
norm=self.norm + other.norm) 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])]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment