From 32270ebf3f61c8c99595fdba990ab15bf652b0e1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Al=C3=A1n=20Mu=C3=B1oz?= <alan.munoz@ed.ac.uk>
Date: Mon, 27 Feb 2023 15:40:12 +0000
Subject: [PATCH] fix(vis_tool): concat_dims supports negative index

---
 src/aliby/utils/vis_tools.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/aliby/utils/vis_tools.py b/src/aliby/utils/vis_tools.py
index 3d4caef4..7d688211 100644
--- a/src/aliby/utils/vis_tools.py
+++ b/src/aliby/utils/vis_tools.py
@@ -63,7 +63,8 @@ def get_cellmasks_at_times(results_path: str, timepoints: t.List[int] = [0]):
 
 
 def concatenate_dims(ndarray, axis1: int, axis2: int):
-    return np.concatenate(np.moveaxis(ndarray, axis1, 0), axis=axis2)
+    axis2 = len(ndarray.shape) + axis2 if axis2 < 0 else axis2
+    return np.concatenate(np.moveaxis(ndarray, axis1, 0), axis=axis2 - 1)
 
 
 def get_tile_mask_pairs(
-- 
GitLab