From 4796a9db872f5a1f8287b7c989a8ddae77941840 Mon Sep 17 00:00:00 2001 From: Kushal Bakshi <52367253+kushalbakshi@users.noreply.github.com> Date: Wed, 17 May 2023 14:41:37 +0000 Subject: [PATCH] Add assertion when returning tif files --- workflow_zstack/paths.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/workflow_zstack/paths.py b/workflow_zstack/paths.py index f2ef680..e53f4af 100644 --- a/workflow_zstack/paths.py +++ b/workflow_zstack/paths.py @@ -39,9 +39,10 @@ def get_volume_tif_file(scan_key): pathlib.Path((session.SessionDirectory & scan_key).fetch1("session_dir")), ) - tiff_filepaths = [fp.as_posix() for fp in sess_dir.rglob("*.tif")][0] + tiff_filepaths = [fp.as_posix() for fp in sess_dir.rglob("*.tif")] if tiff_filepaths: - return tiff_filepaths + assert len(tiff_filepaths) == 1, "More than 1 `.tif` file in file path. Please ensure the session directory contains only 1 image file." + return tiff_filepaths[0] else: raise FileNotFoundError(f"No tiff file found in {sess_dir}")