Skip to content

Commit

Permalink
Models: fixed ProjectionGeometry slicing
Browse files Browse the repository at this point in the history
Signed-off-by: Nicola VIGANO <nicola.vigano@esrf.fr>
  • Loading branch information
Obi-Wan committed Mar 27, 2024
1 parent 670ba60 commit 5447b2f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion corrct/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

from abc import ABC

from copy import deepcopy


ROT_DIRS_VALID = ("clockwise", "counter-clockwise")

Expand Down Expand Up @@ -71,7 +73,7 @@ def __getitem__(self, indx: Any):
"""

def slice_array(vecs_arr: NDArray, indx: Any):
if len(vecs_arr.shape) > 1:
if len(vecs_arr.shape) > 1 and vecs_arr.shape[0] > 1:
return vecs_arr[indx, :]
else:
return vecs_arr
Expand All @@ -84,6 +86,16 @@ def slice_array(vecs_arr: NDArray, indx: Any):
det_v_xyz=slice_array(self.det_v_xyz, indx),
)

def copy(self) -> "ProjectionGeometry":
"""Deepcopy an existing geometry.
Returns
-------
ProjectionGeometry
The new instance of ProjectionGeometry
"""
return deepcopy(self)

@staticmethod
def get_default_parallel(
*,
Expand Down

0 comments on commit 5447b2f

Please sign in to comment.