From 0a09e6828d67a95689aadeb5234fe55926bbe9d2 Mon Sep 17 00:00:00 2001
From: alan <alan@Arran.bio.ed.ac.uk>
Date: Tue, 6 Sep 2022 17:59:09 +0100
Subject: [PATCH] refactor(tiler,ext): get_traps->get_tiles

---
 README.md                    |  2 +-
 aliby/tile/tiler.py          | 10 +++++++++-
 aliby/utils/imageViewer.py   |  2 +-
 extraction/core/extractor.py |  7 ++++---
 4 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/README.md b/README.md
index 6d330a9d..fac23288 100644
--- a/README.md
+++ b/README.md
@@ -105,7 +105,7 @@ Alternatively, if you want to get all the traps at a given timepoint:
 
 ```python
 timepoint = 0
-seg_expt.get_traps_timepoints(timepoint, tile_size=96, channels=None,
+seg_expt.get_tiles_timepoints(timepoint, tile_size=96, channels=None,
                                 z=[0,1,2,3,4])
 ```
 
diff --git a/aliby/tile/tiler.py b/aliby/tile/tiler.py
index 80402541..2740022a 100644
--- a/aliby/tile/tiler.py
+++ b/aliby/tile/tiler.py
@@ -488,8 +488,16 @@ class Tiler(ProcessABC):
             self.run_tp(frame)
         return None
 
+    def get_traps_timepoint(self, *args, **kwargs):
+        #
+        print(
+            DeprecationWarning("Deprecated:Use get_tiles_timepoint instead.")
+        )
+
+        return self.get_tiles_timepoint(*args, **kwargs)
+
     # The next set of functions are necessary for the extraction object
-    def get_traps_timepoint(
+    def get_tiles_timepoint(
         self, tp, tile_shape=None, channels=None, z=None
     ) -> np.ndarray:
         """
diff --git a/aliby/utils/imageViewer.py b/aliby/utils/imageViewer.py
index d53b4f0e..67490812 100644
--- a/aliby/utils/imageViewer.py
+++ b/aliby/utils/imageViewer.py
@@ -197,7 +197,7 @@ class remoteImageViewer:
             # tps = set(tps).difference(self.full.keys())
             for ch, tp in ch_tps:
                 if (ch, tp) not in self.full:
-                    self.full[(ch, tp)] = self.tiler.get_traps_timepoint(
+                    self.full[(ch, tp)] = self.tiler.get_tiles_timepoint(
                         tp, channels=[ch], z=[z]
                     )[:, 0, 0, ..., z]
             requested_trap = {tp: self.full[(ch, tp)] for ch, tp in ch_tps}
diff --git a/extraction/core/extractor.py b/extraction/core/extractor.py
index ee7e58b6..b5886782 100644
--- a/extraction/core/extractor.py
+++ b/extraction/core/extractor.py
@@ -256,7 +256,7 @@ class Extractor(ProcessABC):
             z = list(range(self.tiler.shape[-1]))
         # gets the data via tiler
         traps = (
-            self.tiler.get_traps_timepoint(
+            self.tiler.get_tiles_timepoint(
                 tp, channels=channel_ids, z=z, **kwargs
             )
             if channel_ids
@@ -294,7 +294,8 @@ class Extractor(ProcessABC):
             A two-tuple of a tuple of results and a tuple with the corresponding trap_id and cell labels
         """
         if labels is None:
-            raise Warning("No labels given. Sorting cells using index.")
+            print("Warning: No labels given. Sorting cells using index.")
+
         cell_fun = True if metric in self._all_cell_funs else False
         idx = []
         results = []
@@ -471,7 +472,7 @@ class Extractor(ProcessABC):
         # find image data at the time point
         # stored as an array arranged as (traps, channels, timepoints, X, Y, Z)
         # Alan: traps does not appear the best name here!
-        traps = self.get_traps(tp, tile_shape=tile_size, channels=tree_chs)
+        traps = self.get_tiles(tp, tile_shape=tile_size, channels=tree_chs)
 
         # generate boolean masks for background as a list with one mask per trap
         if self.params.sub_bg:
-- 
GitLab