From bc8afedcf92470eff6e0f470137fd8655cd60590 Mon Sep 17 00:00:00 2001 From: jim Date: Mon, 11 May 2015 11:47:40 -0500 Subject: [PATCH] resolves #23 - fixed bug due to improperly refactored logic condition --- nd2reader/parser.py | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/nd2reader/parser.py b/nd2reader/parser.py index e8e3d96..0aaa705 100644 --- a/nd2reader/parser.py +++ b/nd2reader/parser.py @@ -22,7 +22,7 @@ class Nd2Parser(object): self._filename = filename self._fh = None self._chunk_map_start_location = None - self._cursor_position = None + self._cursor_position = 0 self._dimension_text = None self._label_map = {} self.metadata = {} @@ -62,11 +62,10 @@ class Nd2Parser(object): def _parse_metadata(self): for label in self._label_map.keys(): - if not label.endswith("LV!") or "LV|" in label: - continue - data = self._read_chunk(self._label_map[label]) - stop = label.index("LV") - self.metadata[label[:stop]] = self._read_metadata(data, 1) + if label.endswith("LV!") or "LV|" in label: + data = self._read_chunk(self._label_map[label]) + stop = label.index("LV") + self.metadata[label[:stop]] = self._read_metadata(data, 1) def _read_map(self): """ @@ -134,10 +133,9 @@ class Nd2Parser(object): array_length = struct.unpack("Q", data.read(8))[0] return array.array("B", data.read(array_length)) - def _parse_metadata_item(self, args): - data, cursor_position = args + def _parse_metadata_item(self, data): new_count, length = struct.unpack("