Skip to content

Commit

Permalink
Updating to be more clear about how AI_start_delay is calculated,
Browse files Browse the repository at this point in the history
particularly in the case of devices that use AI_start_delay_ticks.
  • Loading branch information
dihm committed Nov 18, 2021
1 parent 7123c4c commit 81b411d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion labscript_devices/NI_DAQmx/blacs_workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ def transition_to_buffered(self, device_name, h5file, initial_values, fresh):
self.h5_file = h5file
self.buffered_rate = device_properties['acquisition_rate']
if device_properties['start_delay_ticks']:
# delay is defined in sample clock ticks
# delay is defined in sample clock ticks, calculate in sec and save for later
self.AI_start_delay = self.AI_start_delay_ticks*self.buffered_rate
self.acquired_data = []
# Stop the manual mode task and start the buffered mode task:
Expand Down
12 changes: 9 additions & 3 deletions labscript_devices/NI_DAQmx/labscript_devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def __init__(
AI_range=None,
AI_range_Diff=None,
AI_start_delay=0,
AI_start_delay_ticks=0,
AI_start_delay_ticks=None,
AI_term='RSE',
AI_term_cfg=None,
AO_range=None,
Expand Down Expand Up @@ -231,8 +231,14 @@ def __init__(
raise LabscriptError(dedent(msg.format(AI_term)))
if AI_term == 'Diff':
self.AI_range = AI_range_Diff
# define AI_start_delay in ticks, assumes AI_start_delay_ticks is defined
self.start_delay_ticks = (AI_start_delay != None)
if AI_start_delay is None:
if AI_start_delay_ticks is not None:
# Tell blacs_worker to use AI_start_delay_ticks to define delay
self.start_delay_ticks = True
else:
self.start_delay_ticks = False
else:
raise LabscriptError("You have specified `AI_start_delay = None` but have not provided `AI_start_delay_ticks`.")
self.num_AO = num_AO
self.num_CI = num_CI
self.ports = ports if ports is not None else {}
Expand Down

0 comments on commit 81b411d

Please sign in to comment.