@@ -336,16 +336,12 @@ def transition_to_buffered(self,device_name,h5file,initial_values,fresh):
336336 #Let's get the final state of the pulseblaster. z's are the args we don't need:
337337 flags ,z ,z ,z = pulse_program [- 1 ]
338338
339- # Always call start_programming regardless of whether we are going to do any
340- # programming or not. This is so that is the programming_scheme is 'pb_stop_programming/STOP'
341- # we are ready to be triggered by a call to pb_stop_programming() even if no programming
342- # occurred due to smart programming:
343- pb_start_programming (PULSE_PROGRAM )
344-
345339 if fresh or (self .smart_cache ['initial_values' ] != initial_values ) or \
346340 (len (self .smart_cache ['pulse_program' ]) != len (pulse_program )) or \
347341 (self .smart_cache ['pulse_program' ] != pulse_program ).any () or \
348342 not self .smart_cache ['ready_to_go' ]:
343+ # Enter programming mode
344+ pb_start_programming (PULSE_PROGRAM )
349345
350346 self .smart_cache ['ready_to_go' ] = True
351347 self .smart_cache ['initial_values' ] = initial_values
@@ -384,17 +380,23 @@ def transition_to_buffered(self,device_name,h5file,initial_values,fresh):
384380 for args in pulse_program :
385381 pb_inst_pbonly (* args )
386382
387- if self .programming_scheme == 'pb_start/BRANCH' :
388- # We will be triggered by pb_start() if we are are the master pseudoclock or a single hardware trigger
389- # from the master if we are not:
390- pb_stop_programming ()
383+ if self .programming_scheme == 'pb_start/BRANCH' :
384+ # We will be triggered by pb_start() if we are are the master pseudoclock or a single hardware trigger
385+ # from the master if we are not:
386+ pb_stop_programming ()
387+ elif self .programming_scheme == 'pb_stop_programming/STOP' :
388+ # Don't call pb_stop_programming(). We don't want to pulseblaster to respond to hardware
389+ # triggers (such as 50/60Hz line triggers) until we are ready to run.
390+ # Our start_method will call pb_stop_programming() when we are ready
391+ pass
392+ else :
393+ raise ValueError ('invalid programming_scheme %s' % str (self .programming_scheme ))
394+
391395 elif self .programming_scheme == 'pb_stop_programming/STOP' :
392- # Don't call pb_stop_programming(). We don't want to pulseblaster to respond to hardware
393- # triggers (such as 50/60Hz line triggers) until we are ready to run.
394- # Our start_method will call pb_stop_programming() when we are ready
395- pass
396- else :
397- raise ValueError ('invalid programming_scheme %s' % str (self .programming_scheme ))
396+ # Ensure start_programming called if the programming_scheme is 'pb_stop_programming/STOP'
397+ # so we are ready to be triggered by a call to pb_stop_programming()
398+ # even if no programming occurred due to smart programming:
399+ pb_start_programming (PULSE_PROGRAM )
398400
399401 # Are there waits in use in this experiment? The monitor waiting for the end
400402 # of the experiment will need to know:
0 commit comments