From d49aa175af1deed13c62e5e8f4a5ad7d0138cee7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Le=20Guyader?= <loic.le.guyader@xfel.eu> Date: Fri, 20 May 2022 09:56:35 +0200 Subject: [PATCH] Adds possibility to get heaxgons of part of a module --- src/toolbox_scs/routines/boz.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/toolbox_scs/routines/boz.py b/src/toolbox_scs/routines/boz.py index ca0dd87..e5ac8d4 100644 --- a/src/toolbox_scs/routines/boz.py +++ b/src/toolbox_scs/routines/boz.py @@ -284,21 +284,28 @@ def _get_pixel_hexagons(module): Parameters: ----------- - module: int, module number + module: either int, for the module number or a 2-d array of corners to + get hexagons from Returns: - a list of hexagons + -------- + a 1-d list of hexagons where corners position are in mm """ hexes = [] - corners = _get_pixel_corners(module) - for y in range(128): - for x in range(512): + if type(module) is int: + corners = _get_pixel_corners(module) + else: + corners = module + + for y in range(corners.shape[0]): + for x in range(corners.shape[1]): c = 1e3*corners[y, x, :, :] # convert to mm hexes.append(Polygon(c)) return hexes + def _add_colorbar(im, ax, loc='right', size='5%', pad=0.05): """Add a colobar on a new axes so it match the plot size. -- GitLab