@@ -168,7 +168,20 @@ def get_freqs(self):
168168 return freqs
169169
170170 def set_output (self , channel , frequency , amplitude , phase ):
171- '''Set frequency, amplitude, and phase of a channel.'''
171+ '''Set frequency, phase, and amplitude of a channel
172+ outside of the buffered sequence from floating point values.
173+
174+ Args:
175+ channel (int): channel to set the instruction for. Zero indexed.
176+ frequency (float):
177+ frequency of output. Floating point number in Hz (0-DDS clock/2).
178+ Will be rounded during quantization to DDS units.
179+ amplitude (float):
180+ amplitude of output. Fraction of maximum output amplitude (0-1).
181+ Will be rounded during quantization to DDS units.
182+ phase (float):
183+ phase of output. Floating point number in degrees (0-360).
184+ Will be rounded during quantization to DDS units.'''
172185 self .conn .write (b'setfreq %d %f\n ' % (channel , frequency ))
173186 self .assert_OK ()
174187 self .conn .write (b'setamp %d %f\n ' % (channel , amplitude ))
@@ -177,7 +190,13 @@ def set_output(self, channel, frequency, amplitude, phase):
177190 self .assert_OK ()
178191
179192 def set_channels (self , channels ):
180- '''Set number of channels to use in buffered sequence.'''
193+ '''Set number of channels to use in buffered sequence.
194+
195+ Args:
196+ channels (int):
197+ If 1-4, sets the number of channels activated for buffered mode.
198+ Lowest channels are always used first.
199+ If 0, simultaneously updates all channels during buffered mode.'''
181200 self .conn .write (b'setchannels %d\n ' % channels )
182201 self .assert_OK ()
183202
@@ -203,8 +222,26 @@ def seti(self, channel, addr, frequency, amplitude, phase):
203222 self .assert_OK ()
204223
205224 def set_batch (self , table ):
206- '''Set frequency, phase, and amplitude of a channel
207- for address addr in buffered sequence.'''
225+ '''Set frequency, phase, and amplitude of all channels
226+ for many addresses in buffered sequence from integer values in a table.
227+
228+ Uses binary instruction encoding in transit to improve write speeds.
229+ :meth:`set_batch` does not send a stop instruction, so call :meth:`stop` separately.
230+
231+ Args:
232+ table (numpy array):
233+ Table should be an array of instructions in a mode-dependent format.
234+ The dtypes should be repeated for each channel, with channel 0s parameters
235+ first, followed by channel1s parameters, etc. depending on the number of channels.
236+ The formats for each channel are as follows:
237+ Single-step mode: ('frequency', '<u4'), ('amplitude', '<u2'), ('phase', '<u2')
238+ Amplitude sweep mode: ('start_amplitude', '<u2'), ('stop_amplitude', '<u2'), ('delta', '<u2'), ('rate', '<u1')
239+ Frequency sweep mode: ('start_frequency', '<u4'), ('stop_frequency', '<u4'), ('delta', '<u4'), ('rate', '<u1')
240+ Phase sweep mode: ('start_phase', '<u2'), ('stop_phase', '<u2'), ('delta', '<u2'), ('rate', '<u1')
241+ Amplitude sweep mode with steps: ('start_amplitude', '<u2'), ('stop_amplitude', '<u2'), ('delta', '<u2'), ('rate', '<u1'), ('frequency', '<u4'), ('phase', '<u2')
242+ Frequency sweep mode with steps: ('start_frequency', '<u4'), ('stop_frequency', '<u4'), ('delta', '<u4'), ('rate', '<u1'), ('amplitude', '<u2'), ('phase', '<u2')
243+ Phase sweep mode with steps: ('start_phase', '<u2'), ('stop_phase', '<u2'), ('delta', '<u2'), ('rate', '<u1'), ('frequency', '<u4'), ('amplitude', '<u2')
244+ Raises: LabscriptError if the table is not compatible with the device's current mode.'''
208245 self .conn .write (b'setb 0 %d\n ' % len (table ))
209246 resp = self .conn .readline ().decode ()
210247 if not resp .startswith ('ready' ):
@@ -273,7 +310,24 @@ def program_manual(self, values):
273310 self .intf .set_output (chan_int , values [chan ]['freq' ], values [chan ]['amp' ], values [chan ]['phase' ])
274311
275312 def transition_to_buffered (self , device_name , h5file , initial_values , fresh ):
313+ '''Configure the DDS Sweeper for buffered execution.
276314
315+ First, data is loaded from the shot files.
316+ Then, static channels are set using the :meth:`set_output` function.
317+ Next, dynamic data is loaded.
318+ If the sequence has run before, the smart cache is used to minimize new updates.
319+ Finally, buffered execution is started.
320+
321+ Args:
322+ device_name (str): labscript name of DDS Sweeper
323+ h5file (str): path to shot file to run
324+ initial_values (dict): Dictionary of output states at start of shot
325+ fresh (bool): When `True`, clear the local :py:attr:`smart_cache`, forcing
326+ a complete reprogramming of the output table.
327+
328+ Returns:
329+ dict: Dictionary of the expected final output states.
330+ '''
277331 if fresh :
278332 self .logger .debug ('\n ------------Clearing smart cache for fresh start-----------' )
279333 self .smart_cache = {'static_data' : None , 'dds_data' : None }
0 commit comments