Skip to content

Commit 91b7c41

Browse files
rsbrosti-am-mounce
authored andcommitted
fix(core): fixing ability for empty property scans inbetween used scans. Now adding a check to block this. Scans must be populated in sequential order.
1 parent 2e875b8 commit 91b7c41

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pyscan/measurement/run_info.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,20 @@ def check(self):
8888
if num_av_scans > 1:
8989
assert False, "More than one average scan is not allowed"
9090

91+
# make sure there are no empty scans inbetween used scans.
92+
used_scan_found = False
93+
scans = self.scans
94+
for i in range(len(scans)):
95+
count_down = len(scans) - i - 1
96+
if used_scan_found is False:
97+
if not (isinstance(scans[count_down], PropertyScan) and len(scans[count_down].input_dict) == 0):
98+
used_scan_found = True
99+
used_scan_index = count_down
100+
else:
101+
assert not (isinstance(scans[count_down], PropertyScan) and len(scans[count_down].input_dict) == 0), \
102+
(f"Found empty PropertyScan (scan{count_down}) below used scan (scan{used_scan_index}).\n"
103+
+ "Scans must be populated in sequential order.")
104+
91105
@property
92106
def scans(self):
93107
''' Returns array of all scans

0 commit comments

Comments
 (0)