From a23f2e45d72f6192d0fa274032979619a6e700e1 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 10:46:24 +0000
Subject: [PATCH] fix(distributors): simplify using cell axis 0

---
 src/extraction/core/functions/distributors.py | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/extraction/core/functions/distributors.py b/src/extraction/core/functions/distributors.py
index 786429c1..8b35c86f 100644
--- a/src/extraction/core/functions/distributors.py
+++ b/src/extraction/core/functions/distributors.py
@@ -19,10 +19,8 @@ def trap_apply(cell_fun, cell_masks, *args, **kwargs):
     **kwargs: dict
         Keyword arguments to pass if needed to custom functions.
     """
-    # find an index for each cell in the trap
-    cells_iter = (*range(cell_masks.shape[2]),)
     # apply cell_fun to each cell and return the results as a list
-    return [cell_fun(cell_masks[..., i], *args, **kwargs) for i in cells_iter]
+    return [cell_fun(mask, *args, **kwargs) for mask in cell_masks]
 
 
 def reduce_z(trap_image: np.ndarray, fun: t.Callable):
-- 
GitLab