From 2881b0f3b1fb2296f08252d7faca38be4f1bdeed Mon Sep 17 00:00:00 2001 From: Gregor Lichtner Date: Wed, 22 May 2019 13:09:18 +0200 Subject: [PATCH] include only valid loops in experiment metadata --- nd2reader/common_raw_metadata.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nd2reader/common_raw_metadata.py b/nd2reader/common_raw_metadata.py index a195563..c4205f6 100644 --- a/nd2reader/common_raw_metadata.py +++ b/nd2reader/common_raw_metadata.py @@ -48,6 +48,11 @@ def get_loops_from_data(loop_data): # take the first dictionary element, it contains all loop data loops = loop_data[six.b('pPeriod')][list(loop_data[six.b('pPeriod')].keys())[0]] + + # exclude invalid periods + if six.b('pPeriodValid') in loop_data: + loops = [loops[i] for i in range(len(loops)) if loop_data[six.b('pPeriodValid')][i] == 1] + return loops