Skip to content
Snippets Groups Projects
Commit 0a16ce90 authored by Ruben Verweij's avatar Ruben Verweij
Browse files

Fix error in loop handling

parent c0f289f4
No related branches found
No related tags found
No related merge requests found
Subproject commit 47a1165d5558515d6df67fb20b3032172de56279
Subproject commit f700c239f8f9d7d1f99a3c10d9f67e2b3b8ef307
......@@ -40,20 +40,25 @@ def parse_roi_type(type_no):
def get_loops_from_data(loop_data):
loops = [loop_data]
if six.b('uiPeriodCount') in loop_data and loop_data[six.b('uiPeriodCount')] > 0:
# special ND experiment
if six.b('pPeriod') not in loop_data:
return []
# take the first dictionary element, it contains all loop data
loops = loop_data[six.b('pPeriod')][list(loop_data[six.b('pPeriod')].keys())[0]]
if six.b('uiPeriodCount') in loop_data and loop_data[six.b('uiPeriodCount')] > 0:
loops = []
for i, period in enumerate(loop_data[six.b('pPeriod')]):
# 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]
try:
if loop_data[six.b('pPeriodValid')][i] == 1:
loops.append(loop_data[six.b('pPeriod')][period])
except IndexError:
continue
else:
# we can't be sure, append all
loops.append(loop_data[six.b('pPeriod')][period])
return loops
return [loop_data]
def guess_sampling_from_loops(duration, loop):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment