Skip to content

Commit 81b411d

Browse files
committed
Updating to be more clear about how AI_start_delay is calculated,
particularly in the case of devices that use AI_start_delay_ticks.
1 parent 7123c4c commit 81b411d

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

labscript_devices/NI_DAQmx/blacs_workers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ def transition_to_buffered(self, device_name, h5file, initial_values, fresh):
537537
self.h5_file = h5file
538538
self.buffered_rate = device_properties['acquisition_rate']
539539
if device_properties['start_delay_ticks']:
540-
# delay is defined in sample clock ticks
540+
# delay is defined in sample clock ticks, calculate in sec and save for later
541541
self.AI_start_delay = self.AI_start_delay_ticks*self.buffered_rate
542542
self.acquired_data = []
543543
# Stop the manual mode task and start the buffered mode task:

labscript_devices/NI_DAQmx/labscript_devices.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def __init__(
9797
AI_range=None,
9898
AI_range_Diff=None,
9999
AI_start_delay=0,
100-
AI_start_delay_ticks=0,
100+
AI_start_delay_ticks=None,
101101
AI_term='RSE',
102102
AI_term_cfg=None,
103103
AO_range=None,
@@ -231,8 +231,14 @@ def __init__(
231231
raise LabscriptError(dedent(msg.format(AI_term)))
232232
if AI_term == 'Diff':
233233
self.AI_range = AI_range_Diff
234-
# define AI_start_delay in ticks, assumes AI_start_delay_ticks is defined
235-
self.start_delay_ticks = (AI_start_delay != None)
234+
if AI_start_delay is None:
235+
if AI_start_delay_ticks is not None:
236+
# Tell blacs_worker to use AI_start_delay_ticks to define delay
237+
self.start_delay_ticks = True
238+
else:
239+
self.start_delay_ticks = False
240+
else:
241+
raise LabscriptError("You have specified `AI_start_delay = None` but have not provided `AI_start_delay_ticks`.")
236242
self.num_AO = num_AO
237243
self.num_CI = num_CI
238244
self.ports = ports if ports is not None else {}

0 commit comments

Comments
 (0)