Skip to content

Commit

Permalink
Add assertion when returning tif files
Browse files Browse the repository at this point in the history
  • Loading branch information
kushalbakshi committed May 17, 2023
1 parent aeec2f8 commit 4796a9d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions workflow_zstack/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")

0 comments on commit 4796a9d

Please sign in to comment.