From c1488e6dd9bc5b693bc2cb33d16818908f1ee7c3 Mon Sep 17 00:00:00 2001 From: Andrew Herzing Date: Tue, 3 Oct 2023 11:42:35 -0400 Subject: [PATCH] Fixed missing elif in io.load --- tomotools/io.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tomotools/io.py b/tomotools/io.py index 6d93db8..53f87e6 100644 --- a/tomotools/io.py +++ b/tomotools/io.py @@ -513,7 +513,7 @@ def load(filename, tilts=None): stack : TomoStack object """ - known_file_types = [".hdf5", ".mrc", ".ali", ".rec", ".hspy", ".dm3", ".dm4"] + known_file_types = ['.hdf5', '.mrc', '.ali', '.rec', '.hspy', '.dm3', '.dm4'] hspy_file_types = ['.hdf5', '.h5', '.mrc', '.ali', '.rec', '.hspy'] dm_file_types = ['.dm3', '.dm4'] @@ -524,7 +524,7 @@ def load(filename, tilts=None): stack = load_hspy(filename, tilts, reader='mrc') else: stack = load_hspy(filename, tilts) - if ext.lower() in dm_file_types: + elif ext.lower() in dm_file_types: stack = load_dm(filename) else: raise ValueError("Unknown file type %s. Must be %s one of " % (ext, [i for i in known_file_types])) @@ -537,5 +537,7 @@ def load(filename, tilts=None): mdocfiles = [i[:-3] + "mdoc" for i in filename] stack = load_serialem_series(filename, mdocfiles) else: - raise ValueError("Unknown file type %s. Must be %s one of " % (ext, [i for i in known_file_types])) + raise ValueError("Unknown file type %s. Must be one of %s " % (ext, [i for i in known_file_types])) + else: + raise ValueError("Unknown filename type %s. Must be either a string or list of strings." % type(filename)) return stack