From f8295af06c6469cce51956ba2ac593ba9666ab00 Mon Sep 17 00:00:00 2001
From: Christopher Rhodes <christopher.rhodes@embl.de>
Date: Thu, 12 Oct 2023 11:10:05 +0200
Subject: [PATCH] Confirmed able to catch failures

---
 extensions/chaeo/util.py      | 3 ++-
 extensions/chaeo/workflows.py | 5 ++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/extensions/chaeo/util.py b/extensions/chaeo/util.py
index 7a8406db..411aafd7 100644
--- a/extensions/chaeo/util.py
+++ b/extensions/chaeo/util.py
@@ -86,4 +86,5 @@ def loop_workflow(files, where_output, workflow_func, params,
                     InMemoryDataAccessor(result['interm'][k])
                 )
 
-    pd.DataFrame(failures).to_csv(Path(where_output) / 'failures.csv')
\ No newline at end of file
+    if len(failures) > 0:
+        pd.DataFrame(failures).to_csv(Path(where_output) / 'failures.csv')
\ No newline at end of file
diff --git a/extensions/chaeo/workflows.py b/extensions/chaeo/workflows.py
index 332f8f9f..c1508f6c 100644
--- a/extensions/chaeo/workflows.py
+++ b/extensions/chaeo/workflows.py
@@ -32,7 +32,6 @@ def export_patches_from_multichannel_zstack(
         export_patch_masks=True,
         export_patch_label_maps=True,
 ) -> Dict:
-
     ti = Timer()
     stack = generate_file_accessor(Path(input_zstack_path))
     fstem = Path(input_zstack_path).stem
@@ -86,7 +85,7 @@ def export_patches_from_multichannel_zstack(
 
     if export_2d_patches_for_annotation:
         files = export_multichannel_patches_from_zstack(
-            Path(where_output) / '2d_patches',
+            Path(where_output) / '2d_patches_annotation',
             stack,
             zmask_meta,
             prefix=fstem,
@@ -109,7 +108,7 @@ def export_patches_from_multichannel_zstack(
 
     if export_2d_patches_for_training:
         files = export_multichannel_patches_from_zstack(
-            Path(where_output) / '2d_patches',
+            Path(where_output) / '2d_patches_training',
             stack.get_one_channel_data(4),
             zmask_meta,
             prefix=fstem,
-- 
GitLab