From 14b581bd7c13edf6b197d51491eabed73c571a57 Mon Sep 17 00:00:00 2001
From: pswain <peter.swain@ed.ac.uk>
Date: Fri, 2 Aug 2024 10:16:28 +0100
Subject: [PATCH] fix(imageviewer): bug in finding channels in tiler

added get_h5files
---
 src/wela/imageviewer.py | 13 +++++++++++--
 src/wela/plotting.py    |  2 +-
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/wela/imageviewer.py b/src/wela/imageviewer.py
index 035b4ee..a2bfd5f 100644
--- a/src/wela/imageviewer.py
+++ b/src/wela/imageviewer.py
@@ -105,7 +105,7 @@ class ImageViewer:
             channels = [
                 ch for ch in self.tiler.channels if ch not in channels_to_skip
             ]
-        channel_indices = [channels.index(ch) for ch in channels]
+        channel_indices = [self.tiler.channels.index(ch) for ch in channels]
         for ch_index, ch in zip(channel_indices, channels):
             tile_dict_for_ch = self.get_all_tiles(tps, ch_index)
             tiles = [x[trap_id] for x in tile_dict_for_ch.values()]
@@ -339,7 +339,7 @@ def colormap(channel):
     return colormap
 
 
-def get_files(
+def get_files_zarr(
     aliby_input: str,
     aliby_output: str,
     omero_name: str,
@@ -351,3 +351,12 @@ def get_files(
     image_file_name = h5file.split("/")[-1].split(".")[0] + ".zarr"
     image_file = str(Path(aliby_input) / omero_name / image_file_name)
     return {"h5file": h5file, "image_file": image_file}
+
+
+def get_h5files(aliby_output: str, omero_name: str, print=False):
+    """List all positions for a particular experiment."""
+    h5files = [f.name for f in (Path(aliby_output) / omero_name).glob("*.h5")]
+    if print:
+        for file in h5files:
+            print(f"\t{file}")
+    return h5files
diff --git a/src/wela/plotting.py b/src/wela/plotting.py
index 56a412e..d57ec6b 100644
--- a/src/wela/plotting.py
+++ b/src/wela/plotting.py
@@ -82,7 +82,7 @@ def kymograph(
     >>> kymograph(dl.df, hue="buddings", group="Msn2")
     >>>
     >>> from wela.sorting import sort_by_budding
-    >>> _, buddings = dl.get_time_series(buddings)
+    >>> _, buddings = dl.get_time_series("buddings")
     >>> sort_order = sort_by_budding(buddings)
     >>> kymograph(dl.df, hue="flavin", sort_order=sort_order)
     """
-- 
GitLab