Skip to content

Commit a455c8b

Browse files
bugfix: Bugfix for pulseblaster fixed shot duration workaround.
Sometimes check_status would run in between transition_to_static and start_run, at which point the instance variables are in an inconsistant state and an AttributeError is raised. The fix sets all instance variables to None when they are not in use and check_status now checks only the last attribute to be set, otherwise concluding that a fixed duration shot is not in progress.
1 parent 3f1d488 commit a455c8b

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

PulseBlaster.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -819,8 +819,10 @@ def init(self):
819819
pb_core_clock(75)
820820

821821
# This is only set to True on a per-shot basis, so set it to False
822-
# for manual mode
822+
# for manual mode. Set associated attributes to None:
823823
self.time_based_stop_workaround = False
824+
self.time_based_shot_duration = None
825+
self.time_based_shot_end_time = None
824826

825827
def program_manual(self,values):
826828

@@ -1022,7 +1024,7 @@ def check_status(self):
10221024
self.waits_pending = False
10231025
except zprocess.TimeoutError:
10241026
pass
1025-
if self.time_based_stop_workaround:
1027+
if self.time_based_shot_end_time is not None:
10261028
import time
10271029
time_based_shot_over = time.time() > self.time_based_shot_end_time
10281030
else:
@@ -1041,8 +1043,10 @@ def transition_to_manual(self):
10411043
done_condition = time_based_shot_over
10421044

10431045
# This is only set to True on a per-shot basis, so reset it to False
1044-
# for manual mode
1046+
# for manual mode. Reset associated attributes to None:
10451047
self.time_based_stop_workaround = False
1048+
self.time_based_shot_duration = None
1049+
self.time_based_shot_end_time = None
10461050

10471051
if done_condition and not waits_pending:
10481052
return True

PulseBlaster_No_DDS.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,10 @@ def init(self):
262262
pb_core_clock(self.core_clock_freq)
263263

264264
# This is only set to True on a per-shot basis, so set it to False
265-
# for manual mode
265+
# for manual mode. Set associated attributes to None:
266266
self.time_based_stop_workaround = False
267+
self.time_based_shot_duration = None
268+
self.time_based_shot_end_time = None
267269

268270
def program_manual(self,values):
269271
# Program the DDS registers:
@@ -416,7 +418,7 @@ def check_status(self):
416418
self.waits_pending = False
417419
except zprocess.TimeoutError:
418420
pass
419-
if self.time_based_stop_workaround:
421+
if self.time_based_shot_end_time is not None:
420422
import time
421423
time_based_shot_over = time.time() > self.time_based_shot_end_time
422424
else:
@@ -435,8 +437,10 @@ def transition_to_manual(self):
435437
done_condition = time_based_shot_over
436438

437439
# This is only set to True on a per-shot basis, so reset it to False
438-
# for manual mode
440+
# for manual mode. Reset associated attributes to None:
439441
self.time_based_stop_workaround = False
442+
self.time_based_shot_duration = None
443+
self.time_based_shot_end_time = None
440444

441445
if done_condition and not waits_pending:
442446
return True

0 commit comments

Comments
 (0)