From 63dd5c5b29682f5627303613eb15bfe23083e24c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Al=C3=A1n=20Mu=C3=B1oz?= <amuoz@ed.ac.uk>
Date: Fri, 15 Jul 2022 12:32:17 +0100
Subject: [PATCH] refactor( fun/dist ):change trap_apply distributor

---
 extraction/core/functions/distributors.py | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/extraction/core/functions/distributors.py b/extraction/core/functions/distributors.py
index 862b8580..42183591 100644
--- a/extraction/core/functions/distributors.py
+++ b/extraction/core/functions/distributors.py
@@ -1,21 +1,19 @@
 import numpy as np
 
 
-def trap_apply(cell_fun, cell_masks, trap_image, **kwargs):
+def trap_apply(cell_fun, cell_masks, *args, **kwargs):
     """
     Apply a cell_function to a mask, trap_image pair
 
     :param cell_fun: function to apply to a cell (from extraction/cell.py)
     :param cell_masks: (numpy 3d array) cells' segmentation mask
-    :param trap_image: the image for the trap in which the cell is (all
+    :param trap_image: (Optional) the image for the trap in which the cell is (all
     channels)
     :**kwargs: parameters to pass if needed for custom functions
     """
 
     cells_iter = (*range(cell_masks.shape[2]),)
-    return [
-        cell_fun(cell_masks[..., i], trap_image, **kwargs) for i in cells_iter
-    ]
+    return [cell_fun(cell_masks[..., i], *args, **kwargs) for i in cells_iter]
 
 
 def reduce_z(trap_image, fun):
-- 
GitLab