From b87b5f6697c63b15ddb5974e83a23d3ddc9deea1 Mon Sep 17 00:00:00 2001 From: Gabriele Girelli Date: Thu, 31 Oct 2019 16:09:29 +0100 Subject: [PATCH] Update raw_metadata.py --- nd2reader/raw_metadata.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nd2reader/raw_metadata.py b/nd2reader/raw_metadata.py index 2e7c428..72720f7 100644 --- a/nd2reader/raw_metadata.py +++ b/nd2reader/raw_metadata.py @@ -163,7 +163,11 @@ class RawMetadata(object): """ z_levels = self._parse_dimension(r""".*?Z\((\d+)\).*?""") if 0 == len(z_levels): - z_levels = range(len(parse_if_not_none(self.z_data, self._parse_z_coordinates))) + z_levels = parse_if_not_none(self.z_data, self._parse_z_coordinates) + if isinstance(z_levels, type(None)): + z_levels = [] + else: + z_levels = range(len(z_levels)) if 0 != z_levels: warnings.warn("Z-levels details missing in metadata. Using Z-coordinates instead.") return z_levels