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