@@ -58,7 +58,11 @@ def init(self):
5858 assert self .prawnblaster .readline ().decode () == "ok\r \n "
5959
6060 def check_status (self ):
61- if self .started and self .wait_table is not None and self .current_wait < len (self .wait_table ):
61+ if (
62+ self .started
63+ and self .wait_table is not None
64+ and self .current_wait < len (self .wait_table )
65+ ):
6266 # Try to read out wait. For now, we're only reading out waits from
6367 # pseudoclock 0 since they should all be the same (requirement imposed by labscript)
6468 self .prawnblaster .write (b"getwait %d %d\r \n " % (0 , self .current_wait ))
@@ -67,6 +71,7 @@ def check_status(self):
6771 # Parse the response from the PrawnBlaster
6872 wait_remaining = int (response )
6973 clock_resolution = self .device_properties ["clock_resolution" ]
74+ input_response_time = self .device_properties ["input_response_time" ]
7075 timeout_length = round (
7176 self .wait_table [self .current_wait ]["timeout" ] / clock_resolution
7277 )
@@ -80,9 +85,13 @@ def check_status(self):
8085 self .wait_timeout [self .current_wait ] = True
8186 else :
8287 # Calculate wait length
88+ # This is a measurement of between the end of the last pulse and the
89+ # retrigger signal. We obtain this by subtracting off the time it takes
90+ # to detect the pulse in the ASM code once the trigger has hit the input
91+ # pin (stored in input_response_time)
8392 self .measured_waits [self .current_wait ] = (
84- timeout_length - wait_remaining
85- ) * clock_resolution
93+ ( timeout_length - wait_remaining ) * clock_resolution
94+ ) - input_response_time
8695 self .wait_timeout [self .current_wait ] = False
8796
8897 self .logger .info (
@@ -142,10 +151,12 @@ def transition_to_buffered(self, device_name, h5file, initial_values, fresh):
142151 if fresh :
143152 self .smart_cache = {}
144153
154+ # fmt: off
145155 self .h5_file = h5file # store reference to h5 file for wait monitor
146156 self .current_wait = 0 # reset wait analysis
147157 self .started = False # Prevent status check from detecting previous wait values
148- # betwen now and when we actually send the start signal
158+ # betwen now and when we actually send the start signal
159+ # fmt: on
149160
150161 # Get data from HDF5 file
151162 pulse_programs = []
0 commit comments