From 4d38383f4e534dd8afc4d46ce1707a1c452e0ae5 Mon Sep 17 00:00:00 2001 From: David Meyer Date: Wed, 5 May 2021 12:22:37 -0400 Subject: [PATCH 01/19] Modifications to `get_capabilities.py` to handle DAQs to include details about Differential input channels. New details include the AI range for diff channels (which may be higher than the single-ended ones) and the number of RSE and Diff physical channels. This can now handle DAQs that do not have any RSE inputs (like the simultaneous sampling ones). Plan to implement to option to use differential inputs next. --- .../NI_DAQmx/models/NI_PXIe_4499.py | 75 +++++++++ .../NI_DAQmx/models/NI_USB_6363.py | 94 +++++++++++ .../NI_DAQmx/models/get_capabilities.py | 152 +++++++++++++++++- 3 files changed, 318 insertions(+), 3 deletions(-) create mode 100644 labscript_devices/NI_DAQmx/models/NI_PXIe_4499.py create mode 100644 labscript_devices/NI_DAQmx/models/NI_USB_6363.py diff --git a/labscript_devices/NI_DAQmx/models/NI_PXIe_4499.py b/labscript_devices/NI_DAQmx/models/NI_PXIe_4499.py new file mode 100644 index 00000000..7160bdeb --- /dev/null +++ b/labscript_devices/NI_DAQmx/models/NI_PXIe_4499.py @@ -0,0 +1,75 @@ +##################################################################### +# # +# /NI_DAQmx/models/_subclass_template.py # +# # +# Copyright 2018, Christopher Billington # +# # +# This file is part of the module labscript_devices, in the # +# labscript suite (see http://labscriptsuite.org), and is # +# licensed under the Simplified BSD License. See the license.txt # +# file in the root of the project for the full license. # +# # +##################################################################### + +##################################################################### +# WARNING # +# # +# This file is auto-generated, any modifications may be # +# overwritten. See README.txt in this folder for details # +# # +##################################################################### + + +from labscript_devices.NI_DAQmx.labscript_devices import NI_DAQmx + +#: +CAPABILITIES = { + 'AI_range': [-10.0, 10.0], + 'AI_range_Diff': [-10.0, 10.0], + 'AI_start_delay': None, + 'AI_start_delay_ticks': 64, + 'AI_term': 'PseudoDiff', + 'AI_term_cfg': { + 'ai0': ['PseudoDiff'], + 'ai1': ['PseudoDiff'], + 'ai10': ['PseudoDiff'], + 'ai11': ['PseudoDiff'], + 'ai12': ['PseudoDiff'], + 'ai13': ['PseudoDiff'], + 'ai14': ['PseudoDiff'], + 'ai15': ['PseudoDiff'], + 'ai2': ['PseudoDiff'], + 'ai3': ['PseudoDiff'], + 'ai4': ['PseudoDiff'], + 'ai5': ['PseudoDiff'], + 'ai6': ['PseudoDiff'], + 'ai7': ['PseudoDiff'], + 'ai8': ['PseudoDiff'], + 'ai9': ['PseudoDiff'], + }, + 'AO_range': None, + 'max_AI_multi_chan_rate': 204800.0, + 'max_AI_single_chan_rate': 204800.0, + 'max_AO_sample_rate': None, + 'max_DO_sample_rate': None, + 'min_semiperiod_measurement': None, + 'num_AI': 16, + 'num_AO': 0, + 'num_CI': 0, + 'ports': {}, + 'supports_buffered_AO': False, + 'supports_buffered_DO': False, + 'supports_semiperiod_measurement': False, + 'supports_simultaneous_AI_sampling': True, +} + + +class NI_PXIe_4499(NI_DAQmx): + description = 'NI-PXIe-4499' + + def __init__(self, *args, **kwargs): + """Class for NI-PXIe-4499""" + # Any provided kwargs take precedent over capabilities + combined_kwargs = CAPABILITIES.copy() + combined_kwargs.update(kwargs) + NI_DAQmx.__init__(self, *args, **combined_kwargs) diff --git a/labscript_devices/NI_DAQmx/models/NI_USB_6363.py b/labscript_devices/NI_DAQmx/models/NI_USB_6363.py new file mode 100644 index 00000000..45ae6cbf --- /dev/null +++ b/labscript_devices/NI_DAQmx/models/NI_USB_6363.py @@ -0,0 +1,94 @@ +##################################################################### +# # +# /NI_DAQmx/models/_subclass_template.py # +# # +# Copyright 2018, Christopher Billington # +# # +# This file is part of the module labscript_devices, in the # +# labscript suite (see http://labscriptsuite.org), and is # +# licensed under the Simplified BSD License. See the license.txt # +# file in the root of the project for the full license. # +# # +##################################################################### + +##################################################################### +# WARNING # +# # +# This file is auto-generated, any modifications may be # +# overwritten. See README.txt in this folder for details # +# # +##################################################################### + + +from labscript_devices.NI_DAQmx.labscript_devices import NI_DAQmx + +#: +CAPABILITIES = { + 'AI_range': [-10.0, 10.0], + 'AI_range_Diff': [-10.0, 10.0], + 'AI_start_delay': 7e-08, + 'AI_term': 'RSE', + 'AI_term_cfg': { + 'ai0': ['RSE', 'NRSE', 'Diff'], + 'ai1': ['RSE', 'NRSE', 'Diff'], + 'ai10': ['RSE', 'NRSE'], + 'ai11': ['RSE', 'NRSE'], + 'ai12': ['RSE', 'NRSE'], + 'ai13': ['RSE', 'NRSE'], + 'ai14': ['RSE', 'NRSE'], + 'ai15': ['RSE', 'NRSE'], + 'ai16': ['RSE', 'NRSE', 'Diff'], + 'ai17': ['RSE', 'NRSE', 'Diff'], + 'ai18': ['RSE', 'NRSE', 'Diff'], + 'ai19': ['RSE', 'NRSE', 'Diff'], + 'ai2': ['RSE', 'NRSE', 'Diff'], + 'ai20': ['RSE', 'NRSE', 'Diff'], + 'ai21': ['RSE', 'NRSE', 'Diff'], + 'ai22': ['RSE', 'NRSE', 'Diff'], + 'ai23': ['RSE', 'NRSE', 'Diff'], + 'ai24': ['RSE', 'NRSE'], + 'ai25': ['RSE', 'NRSE'], + 'ai26': ['RSE', 'NRSE'], + 'ai27': ['RSE', 'NRSE'], + 'ai28': ['RSE', 'NRSE'], + 'ai29': ['RSE', 'NRSE'], + 'ai3': ['RSE', 'NRSE', 'Diff'], + 'ai30': ['RSE', 'NRSE'], + 'ai31': ['RSE', 'NRSE'], + 'ai4': ['RSE', 'NRSE', 'Diff'], + 'ai5': ['RSE', 'NRSE', 'Diff'], + 'ai6': ['RSE', 'NRSE', 'Diff'], + 'ai7': ['RSE', 'NRSE', 'Diff'], + 'ai8': ['RSE', 'NRSE'], + 'ai9': ['RSE', 'NRSE'], + }, + 'AO_range': [-10.0, 10.0], + 'max_AI_multi_chan_rate': 1000000.0, + 'max_AI_single_chan_rate': 2000000.0, + 'max_AO_sample_rate': 2857142.8571428573, + 'max_DO_sample_rate': 10000000.0, + 'min_semiperiod_measurement': 1e-07, + 'num_AI': 32, + 'num_AO': 4, + 'num_CI': 4, + 'ports': { + 'port0': {'num_lines': 32, 'supports_buffered': True}, + 'port1': {'num_lines': 8, 'supports_buffered': False}, + 'port2': {'num_lines': 8, 'supports_buffered': False}, + }, + 'supports_buffered_AO': True, + 'supports_buffered_DO': True, + 'supports_semiperiod_measurement': True, + 'supports_simultaneous_AI_sampling': False, +} + + +class NI_USB_6363(NI_DAQmx): + description = 'NI-USB-6363' + + def __init__(self, *args, **kwargs): + """Class for NI-USB-6363""" + # Any provided kwargs take precedent over capabilities + combined_kwargs = CAPABILITIES.copy() + combined_kwargs.update(kwargs) + NI_DAQmx.__init__(self, *args, **combined_kwargs) diff --git a/labscript_devices/NI_DAQmx/models/get_capabilities.py b/labscript_devices/NI_DAQmx/models/get_capabilities.py index acda3512..afab4f45 100644 --- a/labscript_devices/NI_DAQmx/models/get_capabilities.py +++ b/labscript_devices/NI_DAQmx/models/get_capabilities.py @@ -178,6 +178,7 @@ def wrapped2(name): DAQmxGetDevAIMaxMultiChanRate = float64_prop(PyDAQmx.DAQmxGetDevAIMaxMultiChanRate) DAQmxGetDevAOVoltageRngs = float64_array_prop(PyDAQmx.DAQmxGetDevAOVoltageRngs) DAQmxGetDevAIVoltageRngs = float64_array_prop(PyDAQmx.DAQmxGetDevAIVoltageRngs) +DAQmxGetPhysicalChanAITermCfgs = int32_prop(PyDAQmx.DAQmxGetPhysicalChanAITermCfgs) def port_supports_buffered(device_name, port, clock_terminal=None): @@ -252,8 +253,13 @@ def AI_start_delay(device_name): Vmin, Vmax = DAQmxGetDevAIVoltageRngs(device_name)[0:2] num_samples = 1000 chan = device_name + '/ai0' + supp_types = DAQmxGetPhysicalChanAITermCfgs(chan) + if supp_types & c.DAQmx_Val_Bit_TermCfg_RSE: + input_type = c.DAQmx_Val_RSE + elif supp_types & c.DAQmx_Val_Bit_TermCfg_Diff: + input_type = c.DAQmx_Val_Diff task.CreateAIVoltageChan( - chan, "", c.DAQmx_Val_RSE, Vmin, Vmax, c.DAQmx_Val_Volts, None + chan, "", input_type, Vmin, Vmax, c.DAQmx_Val_Volts, None ) task.CfgSampClkTiming( "", rate, c.DAQmx_Val_Rising, c.DAQmx_Val_ContSamps, num_samples @@ -265,7 +271,12 @@ def AI_start_delay(device_name): sample_timebase_rate = float64() task.GetStartTrigDelay(start_trig_delay) - task.GetDelayFromSampClkDelay(delay_from_sample_clock) + try: + task.GetDelayFromSampClkDelay(delay_from_sample_clock) + except PyDAQmx.DAQmxFunctions.AttributeNotSupportedInTaskContextError: + # seems simultaneous sampling devices do not have this property, + # so assume it is zero + delay_from_sample_clock.value = 0 task.GetSampClkTimebaseRate(sample_timebase_rate) task.ClearTask() @@ -275,6 +286,26 @@ def AI_start_delay(device_name): return total_delay_in_seconds +def supported_AI_terminal_configurations(device_name): + """Determine which analong input configurations are supported for each AI. + + Valid options are RSE, NRSE, Diff, and PseudoDiff. + The labscript driver only supports RSE, NRSE, and Diff. + """ + supp_types = {} + poss_types = {'RSE': c.DAQmx_Val_Bit_TermCfg_RSE, + 'NRSE': c.DAQmx_Val_Bit_TermCfg_NRSE, + 'Diff': c.DAQmx_Val_Bit_TermCfg_Diff, + 'PseudoDiff': c.DAQmx_Val_Bit_TermCfg_PseudoDIFF} + chans = DAQmxGetDevAIPhysicalChans(device_name) + for chan in chans: + byte = DAQmxGetPhysicalChanAITermCfgs(device_name+'/'+chan) + chan_types = [key for key, val in poss_types.items() if val & byte] + supp_types[chan] = chan_types + + return supp_types + + def supported_AI_ranges_for_non_differential_input(device_name, AI_ranges): """Empirically determine the analog input voltage ranges for non-differential inputs. @@ -403,7 +434,8 @@ def get_min_semiperiod_measurement(device_name): models = [] for name in DAQmxGetSysDevNames().split(', '): - model = DAQmxGetDevProductType(name) + # ignore extra details in model names + model = DAQmxGetDevProductType(name).split(' ')[0] print("found device:", name, model) if model not in models: models.append(model) @@ -495,6 +527,120 @@ def get_min_semiperiod_measurement(device_name): capabilities[model]["AI_range"] = [Vmin, Vmax] else: capabilities[model]["AI_range"] = None + capabilities = json.load(f) + except ValueError: + pass + + +models = [] +for name in DAQmxGetSysDevNames().split(', '): + # ignore extra details in model names + model = DAQmxGetDevProductType(name).split(' ')[0] + print("found device:", name, model) + if model not in models: + models.append(model) + capabilities[model] = {} + try: + capabilities[model]["supports_buffered_AO"] = DAQmxGetDevAOSampClkSupported( + name + ) + except PyDAQmx.DAQmxFunctions.AttrNotSupportedError: + capabilities[model]["supports_buffered_AO"] = False + try: + capabilities[model]["max_DO_sample_rate"] = DAQmxGetDevDOMaxRate(name) + capabilities[model]["supports_buffered_DO"] = True + except PyDAQmx.DAQmxFunctions.AttrNotSupportedError: + capabilities[model]["max_DO_sample_rate"] = None + capabilities[model]["supports_buffered_DO"] = False + if capabilities[model]["supports_buffered_AO"]: + capabilities[model]["max_AO_sample_rate"] = DAQmxGetDevAOMaxRate(name) + else: + capabilities[model]["max_AO_sample_rate"] = None + + capabilities[model]["num_AO"] = len(DAQmxGetDevAOPhysicalChans(name)) + capabilities[model]["num_AI"] = len(DAQmxGetDevAIPhysicalChans(name)) + if capabilities[model]["num_AI"] > 0: + single_rate = DAQmxGetDevAIMaxSingleChanRate(name) + multi_rate = DAQmxGetDevAIMaxMultiChanRate(name) + else: + single_rate = None + multi_rate = None + capabilities[model]["max_AI_single_chan_rate"] = single_rate + capabilities[model]["max_AI_multi_chan_rate"] = multi_rate + if capabilities[model]["num_AI"] > 0: + capabilities[model]["AI_term_cfg"] = supported_AI_terminal_configurations(name) + cfgs = [item for sublist in capabilities[model]["AI_term_cfg"].values() + for item in sublist] + capabilities[model]["num_AI_Diff"] = cfgs.count('Diff') + capabilities[model]["num_AI_RSE"] = cfgs.count('RSE') + else: + capabilities[model]["AI_term_cfg"] = None + + capabilities[model]["ports"] = {} + ports = DAQmxGetDevDOPorts(name) + chans = DAQmxGetDevDOLines(name) + for port in ports: + if '_' in port: + # Ignore the alternate port names such as 'port0_32' that allow using two or + # more ports together as a single, larger one: + continue + port_info = {} + capabilities[model]["ports"][port] = port_info + port_chans = [chan for chan in chans if chan.split('/')[0] == port] + port_info['num_lines'] = len(port_chans) + if capabilities[model]["supports_buffered_DO"]: + port_info['supports_buffered'] = port_supports_buffered(name, port) + else: + port_info['supports_buffered'] = False + + capabilities[model]["num_CI"] = len(DAQmxGetDevCIPhysicalChans(name)) + supports_semiperiod = supports_semiperiod_measurement(name) + capabilities[model]["supports_semiperiod_measurement"] = supports_semiperiod + if capabilities[model]["num_CI"] > 0 and supports_semiperiod: + min_semiperiod_measurement = get_min_semiperiod_measurement(name) + else: + min_semiperiod_measurement = None + capabilities[model]["min_semiperiod_measurement"] = min_semiperiod_measurement + + if capabilities[model]['num_AO'] > 0: + AO_ranges = [] + raw_limits = DAQmxGetDevAOVoltageRngs(name) + for i in range(0, len(raw_limits), 2): + Vmin, Vmax = raw_limits[i], raw_limits[i + 1] + AO_ranges.append([Vmin, Vmax]) + # Find range with the largest maximum voltage and use that: + Vmin, Vmax = max(AO_ranges, key=lambda range: range[1]) + # Confirm that no other range has a voltage lower than Vmin, + # since if it does, this violates our assumptions and things might not + # be as simple as having a single range: + assert min(AO_ranges)[0] >= Vmin + capabilities[model]["AO_range"] = [Vmin, Vmax] + else: + capabilities[model]["AO_range"] = None + + if capabilities[model]['num_AI'] > 0: + AI_ranges = [] + raw_limits = DAQmxGetDevAIVoltageRngs(name) + for i in range(0, len(raw_limits), 2): + Vmin, Vmax = raw_limits[i], raw_limits[i + 1] + AI_ranges.append([Vmin, Vmax]) + # Find range with the largest maximum voltage and use that: + Vmin_raw, Vmax_raw = max(AI_ranges, key=lambda range: range[1]) + # Confirm that no other range has a voltage lower than Vmin, + # since if it does, this violates our assumptions and things might not + # be as simple as having a single range: + assert min(AI_ranges)[0] >= Vmin_raw + capabilities[model]["AI_range_Diff"] = [Vmin_raw, Vmax_raw] + if 'RSE' in capabilities[model]["AI_term_cfg"]['ai0']: + # Now limit to non-differential inputs (if available), which may have lower ranges + AI_ranges = supported_AI_ranges_for_non_differential_input(name, AI_ranges) + # Find RSE range with the largest maximum voltage and use that: + Vmin, Vmax = max(AI_ranges, key=lambda range: range[1]) + assert min(AI_ranges)[0] >= Vmin + capabilities[model]["AI_range"] = [Vmin, Vmax] + else: + capabilities[model]["AI_range"] = None + capabilities[model]["AI_range_Diff"] = None if capabilities[model]["num_AI"] > 0: capabilities[model]["AI_start_delay"] = AI_start_delay(name) From 5193aa93c06b36f1a3f62e8dfb73376ce55d5359 Mon Sep 17 00:00:00 2001 From: David Meyer Date: Wed, 5 May 2021 17:31:17 -0400 Subject: [PATCH 02/19] Modified NI_DAQmx to handle differentially terminated analog inputs. Behavior is to either have all the inputs as single-ended or differential. Also modified `get_capabilities.py` a little more so that it will correctly set the default AI termination for devices that do not support RSE. Tested with a NI USB 6366. Was able to simultaneously sample at 2MS/s on two channels (the max spec for this device). --- labscript_devices/NI_DAQmx/blacs_tabs.py | 3 + labscript_devices/NI_DAQmx/blacs_workers.py | 9 ++- .../NI_DAQmx/labscript_devices.py | 22 +++++- .../NI_DAQmx/models/NI_USB_6366.py | 68 +++++++++++++++++++ .../NI_DAQmx/models/capabilities.json | 68 +++++++++++++++++++ .../NI_DAQmx/models/get_capabilities.py | 13 ++-- 6 files changed, 172 insertions(+), 11 deletions(-) create mode 100644 labscript_devices/NI_DAQmx/models/NI_USB_6366.py diff --git a/labscript_devices/NI_DAQmx/blacs_tabs.py b/labscript_devices/NI_DAQmx/blacs_tabs.py index 527d765f..ffe30a26 100644 --- a/labscript_devices/NI_DAQmx/blacs_tabs.py +++ b/labscript_devices/NI_DAQmx/blacs_tabs.py @@ -41,6 +41,7 @@ def initialise_GUI(self): num_AO = properties['num_AO'] num_AI = properties['num_AI'] + AI_chans = properties['AI_chans'] ports = properties['ports'] num_CI = properties['num_CI'] @@ -187,6 +188,8 @@ def initialise_GUI(self): { 'MAX_name': self.MAX_name, 'num_AI': num_AI, + 'AI_chans': AI_chans, + 'AI_term': properties['AI_term'], 'AI_range': properties['AI_range'], 'AI_start_delay': properties['AI_start_delay'], 'clock_terminal': clock_terminal, diff --git a/labscript_devices/NI_DAQmx/blacs_workers.py b/labscript_devices/NI_DAQmx/blacs_workers.py index 7e12047f..14e7f95c 100644 --- a/labscript_devices/NI_DAQmx/blacs_workers.py +++ b/labscript_devices/NI_DAQmx/blacs_workers.py @@ -408,7 +408,7 @@ def init(self): # Hard coded for now. Perhaps we will add functionality to enable # and disable inputs in manual mode, and adjust the rate: - self.manual_mode_chans = ['ai%d' % i for i in range(self.num_AI)] + self.manual_mode_chans = self.AI_chans self.manual_mode_rate = 1000 # An event for knowing when the wait durations are known, so that we may use @@ -471,11 +471,16 @@ def start_task(self, chans, rate): self.read_array = np.zeros((num_samples, len(chans)), dtype=np.float64) self.task = Task() + if self.AI_term == 'RSE': + term = DAQmx_Val_RSE + elif self.AI_term == 'Diff': + term = DAQmx_Val_Diff + for chan in chans: self.task.CreateAIVoltageChan( self.MAX_name + '/' + chan, "", - DAQmx_Val_RSE, + term, self.AI_range[0], self.AI_range[1], DAQmx_Val_Volts, diff --git a/labscript_devices/NI_DAQmx/labscript_devices.py b/labscript_devices/NI_DAQmx/labscript_devices.py index dd5107d4..08189762 100644 --- a/labscript_devices/NI_DAQmx/labscript_devices.py +++ b/labscript_devices/NI_DAQmx/labscript_devices.py @@ -59,6 +59,8 @@ class NI_DAQmx(IntermediateDevice): "clock_mirror_terminal", "AI_range", "AI_start_delay", + "AI_term", + "AI_chans", "AO_range", "max_AI_multi_chan_rate", "max_AI_single_chan_rate", @@ -72,6 +74,7 @@ class NI_DAQmx(IntermediateDevice): "supports_buffered_AO", "supports_buffered_DO", "supports_semiperiod_measurement", + "supports_simultaneous_AI_sampling", "clock_limit", "wait_monitor_minimum_pulse_width", "wait_monitor_supports_wait_completed_events", @@ -90,7 +93,10 @@ def __init__( clock_mirror_terminal=None, acquisition_rate=None, AI_range=None, + AI_range_Diff=None, AI_start_delay=0, + AI_term='RSE', + AI_term_cfg=None, AO_range=None, max_AI_multi_chan_rate=None, max_AI_single_chan_rate=None, @@ -104,6 +110,7 @@ def __init__( supports_buffered_AO=False, supports_buffered_DO=False, supports_semiperiod_measurement=False, + supports_simultaneous_AI_sampling=False, **kwargs ): """Generic class for NI_DAQmx devices. @@ -192,12 +199,20 @@ def __init__( self.max_DO_sample_rate = max_DO_sample_rate self.min_semiperiod_measurement = min_semiperiod_measurement self.num_AI = num_AI + self.AI_term = AI_term + self.AI_chans = [key for key,val in AI_term_cfg.items() if self.AI_term in val] + if not len(self.AI_chans): + msg = """AI termination {0} not supported by this device.""" + raise LabscriptError(dedent(msg.format(AI_term))) + if AI_term == 'Diff': + self.AI_range = AI_range_Diff self.num_AO = num_AO self.num_CI = num_CI self.ports = ports if ports is not None else {} self.supports_buffered_AO = supports_buffered_AO self.supports_buffered_DO = supports_buffered_DO self.supports_semiperiod_measurement = supports_semiperiod_measurement + self.supports_simultaneous_AI_sampling = supports_simultaneous_AI_sampling if self.supports_buffered_DO and self.supports_buffered_AO: self.clock_limit = min(self.max_DO_sample_rate, self.max_AO_sample_rate) @@ -291,8 +306,7 @@ def add_device(self, device): buffered output""" raise ValueError(dedent(msg) % port_str) elif isinstance(device, AnalogIn): - ai_num = split_conn_AI(device.connection) - if ai_num >= self.num_AI: + if device.connection not in self.AI_chans: msg = """Cannot add analog input with connection string '%s' to device with num_AI=%d""" raise ValueError(dedent(msg) % (device.connection, self.num_AI)) @@ -352,7 +366,9 @@ def _check_AI_not_too_fast(self, AI_table): # Either no AI in use, or already checked against single channel rate in # __init__. return - if self.acquisition_rate <= self.max_AI_multi_chan_rate / n: + if self.supports_simultaneous_AI_sampling and self.acquisition_rate <= self.max_AI_multi_chan_rate: + return + elif self.acquisition_rate <= self.max_AI_multi_chan_rate / n: return msg = """Requested acqusition_rate %f for device %s with %d analog input channels in use is too fast. Device supports a rate of %f per channel when diff --git a/labscript_devices/NI_DAQmx/models/NI_USB_6366.py b/labscript_devices/NI_DAQmx/models/NI_USB_6366.py new file mode 100644 index 00000000..4acc7ee3 --- /dev/null +++ b/labscript_devices/NI_DAQmx/models/NI_USB_6366.py @@ -0,0 +1,68 @@ +##################################################################### +# # +# /NI_DAQmx/models/_subclass_template.py # +# # +# Copyright 2018, Christopher Billington # +# # +# This file is part of the module labscript_devices, in the # +# labscript suite (see http://labscriptsuite.org), and is # +# licensed under the Simplified BSD License. See the license.txt # +# file in the root of the project for the full license. # +# # +##################################################################### + +##################################################################### +# WARNING # +# # +# This file is auto-generated, any modifications may be # +# overwritten. See README.txt in this folder for details # +# # +##################################################################### + + +from labscript_devices.NI_DAQmx.labscript_devices import NI_DAQmx + +CAPABILITIES = { + 'AI_range': [-10.0, 10.0], + 'AI_range_Diff': [-10.0, 10.0], + 'AI_start_delay': 4e-08, + 'AI_term': 'Diff', + 'AI_term_cfg': { + 'ai0': ['Diff'], + 'ai1': ['Diff'], + 'ai2': ['Diff'], + 'ai3': ['Diff'], + 'ai4': ['Diff'], + 'ai5': ['Diff'], + 'ai6': ['Diff'], + 'ai7': ['Diff'], + }, + 'AO_range': [-10.0, 10.0], + 'max_AI_multi_chan_rate': 2000000.0, + 'max_AI_single_chan_rate': 2000000.0, + 'max_AO_sample_rate': 3333333.3333333335, + 'max_DO_sample_rate': 10000000.0, + 'min_semiperiod_measurement': 1e-07, + 'num_AI': 8, + 'num_AO': 2, + 'num_CI': 4, + 'ports': { + 'port0': {'num_lines': 8, 'supports_buffered': True}, + 'port1': {'num_lines': 8, 'supports_buffered': False}, + 'port2': {'num_lines': 8, 'supports_buffered': False}, + }, + 'supports_buffered_AO': True, + 'supports_buffered_DO': True, + 'supports_semiperiod_measurement': True, + 'supports_simultaneous_AI_sampling': True, +} + + +class NI_USB_6366(NI_DAQmx): + description = 'NI-USB-6366' + + def __init__(self, *args, **kwargs): + # Any provided kwargs take precedent over capabilities + combined_kwargs = CAPABILITIES.copy() + combined_kwargs.update(kwargs) + NI_DAQmx.__init__(self, *args, **combined_kwargs) diff --git a/labscript_devices/NI_DAQmx/models/capabilities.json b/labscript_devices/NI_DAQmx/models/capabilities.json index 2f34c1ea..25ea989e 100644 --- a/labscript_devices/NI_DAQmx/models/capabilities.json +++ b/labscript_devices/NI_DAQmx/models/capabilities.json @@ -465,5 +465,73 @@ "supports_buffered_AO": true, "supports_buffered_DO": true, "supports_semiperiod_measurement": true + }, + "USB-6366": { + "AI_range": [ + -10.0, + 10.0 + ], + "AI_range_Diff": [ + -10.0, + 10.0 + ], + "AI_start_delay": 4e-08, + "AI_term": "Diff", + "AI_term_cfg": { + "ai0": [ + "Diff" + ], + "ai1": [ + "Diff" + ], + "ai2": [ + "Diff" + ], + "ai3": [ + "Diff" + ], + "ai4": [ + "Diff" + ], + "ai5": [ + "Diff" + ], + "ai6": [ + "Diff" + ], + "ai7": [ + "Diff" + ] + }, + "AO_range": [ + -10.0, + 10.0 + ], + "max_AI_multi_chan_rate": 2000000.0, + "max_AI_single_chan_rate": 2000000.0, + "max_AO_sample_rate": 3333333.3333333335, + "max_DO_sample_rate": 10000000.0, + "min_semiperiod_measurement": 1e-07, + "num_AI": 8, + "num_AO": 2, + "num_CI": 4, + "ports": { + "port0": { + "num_lines": 8, + "supports_buffered": true + }, + "port1": { + "num_lines": 8, + "supports_buffered": false + }, + "port2": { + "num_lines": 8, + "supports_buffered": false + } + }, + "supports_buffered_AO": true, + "supports_buffered_DO": true, + "supports_semiperiod_measurement": true, + "supports_simultaneous_AI_sampling": true } } \ No newline at end of file diff --git a/labscript_devices/NI_DAQmx/models/get_capabilities.py b/labscript_devices/NI_DAQmx/models/get_capabilities.py index afab4f45..77965f3d 100644 --- a/labscript_devices/NI_DAQmx/models/get_capabilities.py +++ b/labscript_devices/NI_DAQmx/models/get_capabilities.py @@ -179,6 +179,7 @@ def wrapped2(name): DAQmxGetDevAOVoltageRngs = float64_array_prop(PyDAQmx.DAQmxGetDevAOVoltageRngs) DAQmxGetDevAIVoltageRngs = float64_array_prop(PyDAQmx.DAQmxGetDevAIVoltageRngs) DAQmxGetPhysicalChanAITermCfgs = int32_prop(PyDAQmx.DAQmxGetPhysicalChanAITermCfgs) +DAQmxGetDevAISimultaneousSamplingSupported = bool_prop(PyDAQmx.DAQmxGetDevAISimultaneousSamplingSupported) def port_supports_buffered(device_name, port, clock_terminal=None): @@ -569,12 +570,12 @@ def get_min_semiperiod_measurement(device_name): capabilities[model]["max_AI_multi_chan_rate"] = multi_rate if capabilities[model]["num_AI"] > 0: capabilities[model]["AI_term_cfg"] = supported_AI_terminal_configurations(name) - cfgs = [item for sublist in capabilities[model]["AI_term_cfg"].values() - for item in sublist] - capabilities[model]["num_AI_Diff"] = cfgs.count('Diff') - capabilities[model]["num_AI_RSE"] = cfgs.count('RSE') - else: - capabilities[model]["AI_term_cfg"] = None + cfgs = [item for sublist in capabilities[model]["AI_term_cfg"].values() for item in sublist] + if cfgs.count('RSE'): + capabilities[model]["AI_term"] = 'RSE' + elif cfgs.count('Diff'): + capabilities[model]["AI_term"] = 'Diff' + capabilities[model]["supports_simultaneous_AI_sampling"] = DAQmxGetDevAISimultaneousSamplingSupported(name) capabilities[model]["ports"] = {} ports = DAQmxGetDevDOPorts(name) From aeaf81b688393d813079ae2486c949242a968544 Mon Sep 17 00:00:00 2001 From: David Meyer Date: Mon, 24 May 2021 16:29:17 -0400 Subject: [PATCH 03/19] Add support of AI pseudoDiff termination. Device that requires this (a PXIe-4499) does handle start delays the same way as other DAQs. This current code just ignores that for now until a better solution gets worked out. DO NOT TRUST ABSOLUTE TIMING OF ANALOG INPUTS on such devices until this gets handled correctly! --- labscript_devices/NI_DAQmx/blacs_workers.py | 2 ++ .../NI_DAQmx/models/get_capabilities.py | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/labscript_devices/NI_DAQmx/blacs_workers.py b/labscript_devices/NI_DAQmx/blacs_workers.py index 14e7f95c..6c3c6573 100644 --- a/labscript_devices/NI_DAQmx/blacs_workers.py +++ b/labscript_devices/NI_DAQmx/blacs_workers.py @@ -475,6 +475,8 @@ def start_task(self, chans, rate): term = DAQmx_Val_RSE elif self.AI_term == 'Diff': term = DAQmx_Val_Diff + elif self.AI_term == 'PseudoDiff': + term = DAQmx_Val_PseudoDiff for chan in chans: self.task.CreateAIVoltageChan( diff --git a/labscript_devices/NI_DAQmx/models/get_capabilities.py b/labscript_devices/NI_DAQmx/models/get_capabilities.py index 77965f3d..b0674368 100644 --- a/labscript_devices/NI_DAQmx/models/get_capabilities.py +++ b/labscript_devices/NI_DAQmx/models/get_capabilities.py @@ -259,6 +259,8 @@ def AI_start_delay(device_name): input_type = c.DAQmx_Val_RSE elif supp_types & c.DAQmx_Val_Bit_TermCfg_Diff: input_type = c.DAQmx_Val_Diff + elif supp_types & c.DAQmx_Val_Bit_TermCfg_PseudoDIFF: + input_type = c.DAQmx_Val_PseudoDiff task.CreateAIVoltageChan( chan, "", input_type, Vmin, Vmax, c.DAQmx_Val_Volts, None ) @@ -271,7 +273,15 @@ def AI_start_delay(device_name): delay_from_sample_clock = float64() sample_timebase_rate = float64() - task.GetStartTrigDelay(start_trig_delay) + try: + task.GetStartTrigDelay(start_trig_delay) + except PyDAQmx.DAQmxFunctions.AttributeNotSupportedInTaskContextError: + # device does not have a Start Trigger Delay property + # is likely a dynamic signal acquisition device with filter + # delays instead. + print(f'\t{model} does not have the StartTrigDelay Property!') + print('\tDo not trust absolute analog input times on this device!!') + start_trig_delay.value = 0 try: task.GetDelayFromSampClkDelay(delay_from_sample_clock) except PyDAQmx.DAQmxFunctions.AttributeNotSupportedInTaskContextError: From 0a5f1d6f95512e0a1e0d70f88c83a1138021139c Mon Sep 17 00:00:00 2001 From: David Meyer Date: Mon, 24 May 2021 17:02:54 -0400 Subject: [PATCH 04/19] Configure get_capabilities to recognize PseudoDiff as a default AI_term. --- labscript_devices/NI_DAQmx/models/get_capabilities.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/labscript_devices/NI_DAQmx/models/get_capabilities.py b/labscript_devices/NI_DAQmx/models/get_capabilities.py index b0674368..118bfd71 100644 --- a/labscript_devices/NI_DAQmx/models/get_capabilities.py +++ b/labscript_devices/NI_DAQmx/models/get_capabilities.py @@ -585,6 +585,8 @@ def get_min_semiperiod_measurement(device_name): capabilities[model]["AI_term"] = 'RSE' elif cfgs.count('Diff'): capabilities[model]["AI_term"] = 'Diff' + elif cfgs.count('PseudoDiff'): + capabilities[model]["AI_term"] = 'PseudoDiff' capabilities[model]["supports_simultaneous_AI_sampling"] = DAQmxGetDevAISimultaneousSamplingSupported(name) capabilities[model]["ports"] = {} From d4eaf67f6574b382660998197e83581b50767da1 Mon Sep 17 00:00:00 2001 From: David Meyer Date: Mon, 24 May 2021 17:33:26 -0400 Subject: [PATCH 05/19] Add ability for DAQmx device to specify analog input delay in terms of sample clock periods. This is done by setting `AI_start_delay=None` and `AI_start_delay_ticks={int}` keyword arguments of labscript_device.__init__(). This is necessary for Dynamic Signal Acquisition devices with delta ADCs to properly calculate their input delays as the sample clock varies. --- labscript_devices/NI_DAQmx/blacs_workers.py | 3 ++ .../NI_DAQmx/labscript_devices.py | 2 + .../NI_DAQmx/models/get_capabilities.py | 47 ++++++++++++++++--- 3 files changed, 46 insertions(+), 6 deletions(-) diff --git a/labscript_devices/NI_DAQmx/blacs_workers.py b/labscript_devices/NI_DAQmx/blacs_workers.py index 6c3c6573..bfbc7aaa 100644 --- a/labscript_devices/NI_DAQmx/blacs_workers.py +++ b/labscript_devices/NI_DAQmx/blacs_workers.py @@ -534,6 +534,9 @@ def transition_to_buffered(self, device_name, h5file, initial_values, fresh): self.buffered_chans = sorted(set(chans), key=split_conn_AI) self.h5_file = h5file self.buffered_rate = device_properties['acquisition_rate'] + if device_properties['AI_start_delay'] == None: + # delay is defined in sample clock ticks + self.AI_start_delay = device_properties['AI_start_delay_ticks']*self.buffered_rate self.acquired_data = [] # Stop the manual mode task and start the buffered mode task: self.stop_task() diff --git a/labscript_devices/NI_DAQmx/labscript_devices.py b/labscript_devices/NI_DAQmx/labscript_devices.py index 08189762..e697a417 100644 --- a/labscript_devices/NI_DAQmx/labscript_devices.py +++ b/labscript_devices/NI_DAQmx/labscript_devices.py @@ -59,6 +59,7 @@ class NI_DAQmx(IntermediateDevice): "clock_mirror_terminal", "AI_range", "AI_start_delay", + "AI_start_delay_ticks", "AI_term", "AI_chans", "AO_range", @@ -95,6 +96,7 @@ def __init__( AI_range=None, AI_range_Diff=None, AI_start_delay=0, + AI_start_delay_ticks=0, AI_term='RSE', AI_term_cfg=None, AO_range=None, diff --git a/labscript_devices/NI_DAQmx/models/get_capabilities.py b/labscript_devices/NI_DAQmx/models/get_capabilities.py index 118bfd71..73f7a2ce 100644 --- a/labscript_devices/NI_DAQmx/models/get_capabilities.py +++ b/labscript_devices/NI_DAQmx/models/get_capabilities.py @@ -279,8 +279,6 @@ def AI_start_delay(device_name): # device does not have a Start Trigger Delay property # is likely a dynamic signal acquisition device with filter # delays instead. - print(f'\t{model} does not have the StartTrigDelay Property!') - print('\tDo not trust absolute analog input times on this device!!') start_trig_delay.value = 0 try: task.GetDelayFromSampClkDelay(delay_from_sample_clock) @@ -297,11 +295,44 @@ def AI_start_delay(device_name): return total_delay_in_seconds +def AI_filter_delay(device_name): + """Determine the filter delay for dynamic signal acquistion devices. + + Returns the delay in clock cycles. Absolute delay will vary with sample rate.""" + if 'PFI0' not in DAQmxGetDevTerminals(device_name): + return None + task = Task() + clock_terminal = '/' + device_name + '/PFI0' + rate = DAQmxGetDevAIMaxSingleChanRate(device_name) + Vmin, Vmax = DAQmxGetDevAIVoltageRngs(device_name)[0:2] + num_samples = 1000 + chan = device_name + '/ai0' + task.CreateAIVoltageChan( + chan, "", c.DAQmx_Val_PseudoDiff, Vmin, Vmax, c.DAQmx_Val_Volts, None + ) + task.CfgSampClkTiming( + "", rate, c.DAQmx_Val_Rising, c.DAQmx_Val_ContSamps, num_samples + ) + task.CfgDigEdgeStartTrig(clock_terminal, c.DAQmx_Val_Rising) + + start_filter_delay = float64() + sample_timebase_rate = float64() + + # get delay in number of clock samples + task.SetAIFilterDelayUnits("", c.DAQmx_Val_SampleClkPeriods) + + task.GetAIFilterDelay("", start_filter_delay) + task.GetSampClkTimebaseRate(sample_timebase_rate) + + task.ClearTask() + + return int(start_filter_delay.value) + + def supported_AI_terminal_configurations(device_name): """Determine which analong input configurations are supported for each AI. Valid options are RSE, NRSE, Diff, and PseudoDiff. - The labscript driver only supports RSE, NRSE, and Diff. """ supp_types = {} poss_types = {'RSE': c.DAQmx_Val_Bit_TermCfg_RSE, @@ -655,10 +686,14 @@ def get_min_semiperiod_measurement(device_name): capabilities[model]["AI_range"] = None capabilities[model]["AI_range_Diff"] = None - if capabilities[model]["num_AI"] > 0: - capabilities[model]["AI_start_delay"] = AI_start_delay(name) - else: + if capabilities[model]["num_AI"] > 0: + if capabilities[model]["AI_term"] == 'PseudoDiff': + capabilities[model]["AI_start_delay_ticks"] = AI_filter_delay(name) capabilities[model]["AI_start_delay"] = None + else: + capabilities[model]["AI_start_delay"] = AI_start_delay(name) + else: + capabilities[model]["AI_start_delay"] = None with open(CAPABILITIES_FILE, 'w', newline='\n') as f: From 539f32823a5900042957d36321cee37a34097429 Mon Sep 17 00:00:00 2001 From: David Meyer Date: Wed, 26 May 2021 08:51:11 -0400 Subject: [PATCH 06/19] Fix AI_start_delay_ticks logic so it actually works. --- labscript_devices/NI_DAQmx/blacs_tabs.py | 1 + labscript_devices/NI_DAQmx/blacs_workers.py | 4 ++-- labscript_devices/NI_DAQmx/labscript_devices.py | 6 ++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/labscript_devices/NI_DAQmx/blacs_tabs.py b/labscript_devices/NI_DAQmx/blacs_tabs.py index ffe30a26..70714efc 100644 --- a/labscript_devices/NI_DAQmx/blacs_tabs.py +++ b/labscript_devices/NI_DAQmx/blacs_tabs.py @@ -192,6 +192,7 @@ def initialise_GUI(self): 'AI_term': properties['AI_term'], 'AI_range': properties['AI_range'], 'AI_start_delay': properties['AI_start_delay'], + 'AI_start_delay_ticks': properties['AI_start_delay_ticks'], 'clock_terminal': clock_terminal, }, ) diff --git a/labscript_devices/NI_DAQmx/blacs_workers.py b/labscript_devices/NI_DAQmx/blacs_workers.py index bfbc7aaa..afe7a1f7 100644 --- a/labscript_devices/NI_DAQmx/blacs_workers.py +++ b/labscript_devices/NI_DAQmx/blacs_workers.py @@ -534,9 +534,9 @@ def transition_to_buffered(self, device_name, h5file, initial_values, fresh): self.buffered_chans = sorted(set(chans), key=split_conn_AI) self.h5_file = h5file self.buffered_rate = device_properties['acquisition_rate'] - if device_properties['AI_start_delay'] == None: + if device_properties['start_delay_ticks']: # delay is defined in sample clock ticks - self.AI_start_delay = device_properties['AI_start_delay_ticks']*self.buffered_rate + 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: self.stop_task() diff --git a/labscript_devices/NI_DAQmx/labscript_devices.py b/labscript_devices/NI_DAQmx/labscript_devices.py index e697a417..3f3e8c59 100644 --- a/labscript_devices/NI_DAQmx/labscript_devices.py +++ b/labscript_devices/NI_DAQmx/labscript_devices.py @@ -80,7 +80,7 @@ class NI_DAQmx(IntermediateDevice): "wait_monitor_minimum_pulse_width", "wait_monitor_supports_wait_completed_events", ], - "device_properties": ["acquisition_rate"], + "device_properties": ["acquisition_rate","start_delay_ticks"], } ) def __init__( @@ -207,7 +207,9 @@ def __init__( msg = """AI termination {0} not supported by this device.""" raise LabscriptError(dedent(msg.format(AI_term))) if AI_term == 'Diff': - self.AI_range = AI_range_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) self.num_AO = num_AO self.num_CI = num_CI self.ports = ports if ports is not None else {} From 3116af4cd0b354f0c8336bbc6247740ab230bd52 Mon Sep 17 00:00:00 2001 From: David Meyer Date: Thu, 21 Oct 2021 17:17:00 -0400 Subject: [PATCH 07/19] Update docstring to include new DAQmx features. --- labscript_devices/NI_DAQmx/labscript_devices.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/labscript_devices/NI_DAQmx/labscript_devices.py b/labscript_devices/NI_DAQmx/labscript_devices.py index 3f3e8c59..39507359 100644 --- a/labscript_devices/NI_DAQmx/labscript_devices.py +++ b/labscript_devices/NI_DAQmx/labscript_devices.py @@ -134,8 +134,20 @@ def __init__( acquisiton_rate (float, optional): Default sample rate of inputs. AI_range (iterable, optional): A `[Vmin, Vmax]` pair that sets the analog input voltage range for all analog inputs. + AI_range_Diff (iterable, optional): A `[Vmin, Vmax]` pair that sets the analog + input voltage range for all analog inputs when using Differential termination. AI_start_delay (float, optional): Time in seconds between start of an analog input task starting and the first sample. + AI_start_delay_ticks (int, optional): Time in sample clock periods between + start of an analog input task starting and the first sample. To use + this method, `AI_start_delay` must be set to `None`. This is necessary + for DAQs that employ delta ADCs. + AI_term (str, optional): Configures the analog input termination for all + analog inputs. Must be supported by the device. Supported options are + `'RSE'`, `'Diff'`, and '`PseudoDiff'`. + AI_term_cfg (dict, optional): Dictionary of analog input channels and their + supported terminations. Best to use `get_capabilities.py` to introspect + these. AO_range (iterable, optional): A `[Vmin, Vmax]` pair that sets the analog output voltage range for all analog outputs. max_AI_multi_chan_rate (float, optional): Max supported analog input From 5be6992ba05b592eb778ee5e1d94697e3328939e Mon Sep 17 00:00:00 2001 From: David Meyer Date: Thu, 21 Oct 2021 17:19:04 -0400 Subject: [PATCH 08/19] Add more robust backwards compatibility checks for installations that have not updated their capabilities file or re-compiled the connection table. Should probably just add an error instructing to recompile if I go ahead and update all the capabilities files. --- labscript_devices/NI_DAQmx/blacs_tabs.py | 6 +++++- labscript_devices/NI_DAQmx/labscript_devices.py | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/labscript_devices/NI_DAQmx/blacs_tabs.py b/labscript_devices/NI_DAQmx/blacs_tabs.py index 70714efc..0abfca28 100644 --- a/labscript_devices/NI_DAQmx/blacs_tabs.py +++ b/labscript_devices/NI_DAQmx/blacs_tabs.py @@ -41,7 +41,11 @@ def initialise_GUI(self): num_AO = properties['num_AO'] num_AI = properties['num_AI'] - AI_chans = properties['AI_chans'] + try: + AI_chans = properties['AI_chans'] + except KeyError: + # assume legacy behavior + AI_chans = [f'ai{i:d}' for i in range(num_AI)] ports = properties['ports'] num_CI = properties['num_CI'] diff --git a/labscript_devices/NI_DAQmx/labscript_devices.py b/labscript_devices/NI_DAQmx/labscript_devices.py index 39507359..9b049004 100644 --- a/labscript_devices/NI_DAQmx/labscript_devices.py +++ b/labscript_devices/NI_DAQmx/labscript_devices.py @@ -214,6 +214,9 @@ def __init__( self.min_semiperiod_measurement = min_semiperiod_measurement self.num_AI = num_AI self.AI_term = AI_term + if AI_term_cfg == None: + # assume legacy configuration if none provided + AI_term_cfg = {f'ai{i:d}': ['RSE'] for i in range(num_AI)} self.AI_chans = [key for key,val in AI_term_cfg.items() if self.AI_term in val] if not len(self.AI_chans): msg = """AI termination {0} not supported by this device.""" From 05146dd39567d82b2c6c88c3e7a69e6121734c53 Mon Sep 17 00:00:00 2001 From: David Meyer Date: Mon, 8 Nov 2021 14:20:20 -0500 Subject: [PATCH 09/19] Update capabilities to include PXIe-4499 and USB-6363 --- .../NI_DAQmx/models/capabilities.json | 265 ++++++++++++++++++ 1 file changed, 265 insertions(+) diff --git a/labscript_devices/NI_DAQmx/models/capabilities.json b/labscript_devices/NI_DAQmx/models/capabilities.json index 25ea989e..8b67103b 100644 --- a/labscript_devices/NI_DAQmx/models/capabilities.json +++ b/labscript_devices/NI_DAQmx/models/capabilities.json @@ -259,6 +259,83 @@ "supports_buffered_DO": true, "supports_semiperiod_measurement": true }, + "PXIe-4499": { + "AI_range": [ + -10.0, + 10.0 + ], + "AI_range_Diff": [ + -10.0, + 10.0 + ], + "AI_start_delay": null, + "AI_start_delay_ticks": 64, + "AI_term": "PseudoDiff", + "AI_term_cfg": { + "ai0": [ + "PseudoDiff" + ], + "ai1": [ + "PseudoDiff" + ], + "ai10": [ + "PseudoDiff" + ], + "ai11": [ + "PseudoDiff" + ], + "ai12": [ + "PseudoDiff" + ], + "ai13": [ + "PseudoDiff" + ], + "ai14": [ + "PseudoDiff" + ], + "ai15": [ + "PseudoDiff" + ], + "ai2": [ + "PseudoDiff" + ], + "ai3": [ + "PseudoDiff" + ], + "ai4": [ + "PseudoDiff" + ], + "ai5": [ + "PseudoDiff" + ], + "ai6": [ + "PseudoDiff" + ], + "ai7": [ + "PseudoDiff" + ], + "ai8": [ + "PseudoDiff" + ], + "ai9": [ + "PseudoDiff" + ] + }, + "AO_range": null, + "max_AI_multi_chan_rate": 204800.0, + "max_AI_single_chan_rate": 204800.0, + "max_AO_sample_rate": null, + "max_DO_sample_rate": null, + "min_semiperiod_measurement": null, + "num_AI": 16, + "num_AO": 0, + "num_CI": 0, + "ports": {}, + "supports_buffered_AO": false, + "supports_buffered_DO": false, + "supports_semiperiod_measurement": false, + "supports_simultaneous_AI_sampling": true + }, "PXIe-6361": { "AI_range": [ -10.0, @@ -466,6 +543,194 @@ "supports_buffered_DO": true, "supports_semiperiod_measurement": true }, + "USB-6363": { + "AI_range": [ + -10.0, + 10.0 + ], + "AI_range_Diff": [ + -10.0, + 10.0 + ], + "AI_start_delay": 7e-08, + "AI_term": "RSE", + "AI_term_cfg": { + "ai0": [ + "RSE", + "NRSE", + "Diff" + ], + "ai1": [ + "RSE", + "NRSE", + "Diff" + ], + "ai10": [ + "RSE", + "NRSE" + ], + "ai11": [ + "RSE", + "NRSE" + ], + "ai12": [ + "RSE", + "NRSE" + ], + "ai13": [ + "RSE", + "NRSE" + ], + "ai14": [ + "RSE", + "NRSE" + ], + "ai15": [ + "RSE", + "NRSE" + ], + "ai16": [ + "RSE", + "NRSE", + "Diff" + ], + "ai17": [ + "RSE", + "NRSE", + "Diff" + ], + "ai18": [ + "RSE", + "NRSE", + "Diff" + ], + "ai19": [ + "RSE", + "NRSE", + "Diff" + ], + "ai2": [ + "RSE", + "NRSE", + "Diff" + ], + "ai20": [ + "RSE", + "NRSE", + "Diff" + ], + "ai21": [ + "RSE", + "NRSE", + "Diff" + ], + "ai22": [ + "RSE", + "NRSE", + "Diff" + ], + "ai23": [ + "RSE", + "NRSE", + "Diff" + ], + "ai24": [ + "RSE", + "NRSE" + ], + "ai25": [ + "RSE", + "NRSE" + ], + "ai26": [ + "RSE", + "NRSE" + ], + "ai27": [ + "RSE", + "NRSE" + ], + "ai28": [ + "RSE", + "NRSE" + ], + "ai29": [ + "RSE", + "NRSE" + ], + "ai3": [ + "RSE", + "NRSE", + "Diff" + ], + "ai30": [ + "RSE", + "NRSE" + ], + "ai31": [ + "RSE", + "NRSE" + ], + "ai4": [ + "RSE", + "NRSE", + "Diff" + ], + "ai5": [ + "RSE", + "NRSE", + "Diff" + ], + "ai6": [ + "RSE", + "NRSE", + "Diff" + ], + "ai7": [ + "RSE", + "NRSE", + "Diff" + ], + "ai8": [ + "RSE", + "NRSE" + ], + "ai9": [ + "RSE", + "NRSE" + ] + }, + "AO_range": [ + -10.0, + 10.0 + ], + "max_AI_multi_chan_rate": 1000000.0, + "max_AI_single_chan_rate": 2000000.0, + "max_AO_sample_rate": 2857142.8571428573, + "max_DO_sample_rate": 10000000.0, + "min_semiperiod_measurement": 1e-07, + "num_AI": 32, + "num_AO": 4, + "num_CI": 4, + "ports": { + "port0": { + "num_lines": 32, + "supports_buffered": true + }, + "port1": { + "num_lines": 8, + "supports_buffered": false + }, + "port2": { + "num_lines": 8, + "supports_buffered": false + } + }, + "supports_buffered_AO": true, + "supports_buffered_DO": true, + "supports_semiperiod_measurement": true, + "supports_simultaneous_AI_sampling": false + }, "USB-6366": { "AI_range": [ -10.0, From f138144a07a67e3f41242f72ffc80a450609efd9 Mon Sep 17 00:00:00 2001 From: David Meyer Date: Mon, 8 Nov 2021 14:28:51 -0500 Subject: [PATCH 10/19] Add nominal support for analog inputs with the NRSE termination. --- labscript_devices/NI_DAQmx/blacs_workers.py | 2 ++ labscript_devices/NI_DAQmx/labscript_devices.py | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/labscript_devices/NI_DAQmx/blacs_workers.py b/labscript_devices/NI_DAQmx/blacs_workers.py index afe7a1f7..384efa3f 100644 --- a/labscript_devices/NI_DAQmx/blacs_workers.py +++ b/labscript_devices/NI_DAQmx/blacs_workers.py @@ -473,6 +473,8 @@ def start_task(self, chans, rate): if self.AI_term == 'RSE': term = DAQmx_Val_RSE + elif self.AI_term == 'NRSE': + term = DAQmx_Val_NRSE elif self.AI_term == 'Diff': term = DAQmx_Val_Diff elif self.AI_term == 'PseudoDiff': diff --git a/labscript_devices/NI_DAQmx/labscript_devices.py b/labscript_devices/NI_DAQmx/labscript_devices.py index 9b049004..1393f4aa 100644 --- a/labscript_devices/NI_DAQmx/labscript_devices.py +++ b/labscript_devices/NI_DAQmx/labscript_devices.py @@ -213,6 +213,7 @@ def __init__( self.max_DO_sample_rate = max_DO_sample_rate self.min_semiperiod_measurement = min_semiperiod_measurement self.num_AI = num_AI + # special handling for AI termination configurations self.AI_term = AI_term if AI_term_cfg == None: # assume legacy configuration if none provided @@ -220,11 +221,11 @@ def __init__( self.AI_chans = [key for key,val in AI_term_cfg.items() if self.AI_term in val] if not len(self.AI_chans): msg = """AI termination {0} not supported by this device.""" - raise LabscriptError(dedent(msg.format(AI_term))) + 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) + self.start_delay_ticks = (AI_start_delay != None) self.num_AO = num_AO self.num_CI = num_CI self.ports = ports if ports is not None else {} From 0767130eadc5a96044d5d7b63d6954e9f1306f29 Mon Sep 17 00:00:00 2001 From: David Meyer Date: Mon, 8 Nov 2021 15:07:35 -0500 Subject: [PATCH 11/19] Adding explanatory warnings to the backwards compatibility code instructing users how to update existing configurations. --- labscript_devices/NI_DAQmx/blacs_tabs.py | 9 ++++++++- labscript_devices/NI_DAQmx/labscript_devices.py | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/labscript_devices/NI_DAQmx/blacs_tabs.py b/labscript_devices/NI_DAQmx/blacs_tabs.py index 0abfca28..247b5ebc 100644 --- a/labscript_devices/NI_DAQmx/blacs_tabs.py +++ b/labscript_devices/NI_DAQmx/blacs_tabs.py @@ -17,6 +17,7 @@ from blacs.device_base_class import DeviceTab from .utils import split_conn_AO, split_conn_DO from . import models +import warnings class NI_DAQmxTab(DeviceTab): @@ -44,8 +45,14 @@ def initialise_GUI(self): try: AI_chans = properties['AI_chans'] except KeyError: - # assume legacy behavior + # new code being run on older model specification file + # assume legacy behavior, warn user to update AI_chans = [f'ai{i:d}' for i in range(num_AI)] + msg = """Connection table was compiled with old model specifications for {0}. + Please recompile the connection table. + """ + warnings.warn(dedent(msg.format(properties['MAX_name'])), FutureWarning) + ports = properties['ports'] num_CI = properties['num_CI'] diff --git a/labscript_devices/NI_DAQmx/labscript_devices.py b/labscript_devices/NI_DAQmx/labscript_devices.py index 1393f4aa..42c92396 100644 --- a/labscript_devices/NI_DAQmx/labscript_devices.py +++ b/labscript_devices/NI_DAQmx/labscript_devices.py @@ -30,6 +30,7 @@ from labscript_utils import dedent from .utils import split_conn_DO, split_conn_AO, split_conn_AI import numpy as np +import warnings _ints = {8: np.uint8, 16: np.uint16, 32: np.uint32, 64: np.uint64} @@ -218,6 +219,12 @@ def __init__( if AI_term_cfg == None: # assume legacy configuration if none provided AI_term_cfg = {f'ai{i:d}': ['RSE'] for i in range(num_AI)} + # warn user to update their local model specs + msg = """Model specifications for {} needs to be updated. + Please run the `get_capabilites.py` and `generate_subclasses.py` + scripts or define the `AI_Term_Cfg` kwarg for your device. + """ + warnings.warn(dedent(msg.format(self.description)), FutureWarning) self.AI_chans = [key for key,val in AI_term_cfg.items() if self.AI_term in val] if not len(self.AI_chans): msg = """AI termination {0} not supported by this device.""" From be7172339251251afd6d0522cccb2774c01fe9a4 Mon Sep 17 00:00:00 2001 From: David Meyer Date: Mon, 8 Nov 2021 15:35:44 -0500 Subject: [PATCH 12/19] Fix extremely bad merge conflict resolution from #70. --- .../NI_DAQmx/models/get_capabilities.py | 150 +++--------------- 1 file changed, 25 insertions(+), 125 deletions(-) diff --git a/labscript_devices/NI_DAQmx/models/get_capabilities.py b/labscript_devices/NI_DAQmx/models/get_capabilities.py index 73f7a2ce..c9f7ff33 100644 --- a/labscript_devices/NI_DAQmx/models/get_capabilities.py +++ b/labscript_devices/NI_DAQmx/models/get_capabilities.py @@ -509,6 +509,16 @@ def get_min_semiperiod_measurement(device_name): multi_rate = None capabilities[model]["max_AI_single_chan_rate"] = single_rate capabilities[model]["max_AI_multi_chan_rate"] = multi_rate + if capabilities[model]["num_AI"] > 0: + capabilities[model]["AI_term_cfg"] = supported_AI_terminal_configurations(name) + cfgs = [item for sublist in capabilities[model]["AI_term_cfg"].values() for item in sublist] + if cfgs.count('RSE'): + capabilities[model]["AI_term"] = 'RSE' + elif cfgs.count('Diff'): + capabilities[model]["AI_term"] = 'Diff' + elif cfgs.count('PseudoDiff'): + capabilities[model]["AI_term"] = 'PseudoDiff' + capabilities[model]["supports_simultaneous_AI_sampling"] = DAQmxGetDevAISimultaneousSamplingSupported(name) capabilities[model]["ports"] = {} ports = DAQmxGetDevDOPorts(name) @@ -558,142 +568,32 @@ def get_min_semiperiod_measurement(device_name): for i in range(0, len(raw_limits), 2): Vmin, Vmax = raw_limits[i], raw_limits[i + 1] AI_ranges.append([Vmin, Vmax]) - # Restrict to the ranges allowed for non-differential input: - AI_ranges = supported_AI_ranges_for_non_differential_input(name, AI_ranges) # Find range with the largest maximum voltage and use that: - Vmin, Vmax = max(AI_ranges, key=lambda range: range[1]) + Vmin_raw, Vmax_raw = max(AI_ranges, key=lambda range: range[1]) # Confirm that no other range has a voltage lower than Vmin, # since if it does, this violates our assumptions and things might not # be as simple as having a single range: + assert min(AI_ranges)[0] >= Vmin_raw + capabilities[model]["AI_range_Diff"] = [Vmin_raw, Vmax_raw] + if 'RSE' in capabilities[model]["AI_term_cfg"]['ai0']: + # Now limit to non-differential inputs (if available), which may have lower ranges + AI_ranges = supported_AI_ranges_for_non_differential_input(name, AI_ranges) + # Find RSE range with the largest maximum voltage and use that: + Vmin, Vmax = max(AI_ranges, key=lambda range: range[1]) assert min(AI_ranges)[0] >= Vmin capabilities[model]["AI_range"] = [Vmin, Vmax] else: capabilities[model]["AI_range"] = None - capabilities = json.load(f) - except ValueError: - pass - - -models = [] -for name in DAQmxGetSysDevNames().split(', '): - # ignore extra details in model names - model = DAQmxGetDevProductType(name).split(' ')[0] - print("found device:", name, model) - if model not in models: - models.append(model) - capabilities[model] = {} - try: - capabilities[model]["supports_buffered_AO"] = DAQmxGetDevAOSampClkSupported( - name - ) - except PyDAQmx.DAQmxFunctions.AttrNotSupportedError: - capabilities[model]["supports_buffered_AO"] = False - try: - capabilities[model]["max_DO_sample_rate"] = DAQmxGetDevDOMaxRate(name) - capabilities[model]["supports_buffered_DO"] = True - except PyDAQmx.DAQmxFunctions.AttrNotSupportedError: - capabilities[model]["max_DO_sample_rate"] = None - capabilities[model]["supports_buffered_DO"] = False - if capabilities[model]["supports_buffered_AO"]: - capabilities[model]["max_AO_sample_rate"] = DAQmxGetDevAOMaxRate(name) - else: - capabilities[model]["max_AO_sample_rate"] = None + capabilities[model]["AI_range_Diff"] = None - capabilities[model]["num_AO"] = len(DAQmxGetDevAOPhysicalChans(name)) - capabilities[model]["num_AI"] = len(DAQmxGetDevAIPhysicalChans(name)) - if capabilities[model]["num_AI"] > 0: - single_rate = DAQmxGetDevAIMaxSingleChanRate(name) - multi_rate = DAQmxGetDevAIMaxMultiChanRate(name) - else: - single_rate = None - multi_rate = None - capabilities[model]["max_AI_single_chan_rate"] = single_rate - capabilities[model]["max_AI_multi_chan_rate"] = multi_rate - if capabilities[model]["num_AI"] > 0: - capabilities[model]["AI_term_cfg"] = supported_AI_terminal_configurations(name) - cfgs = [item for sublist in capabilities[model]["AI_term_cfg"].values() for item in sublist] - if cfgs.count('RSE'): - capabilities[model]["AI_term"] = 'RSE' - elif cfgs.count('Diff'): - capabilities[model]["AI_term"] = 'Diff' - elif cfgs.count('PseudoDiff'): - capabilities[model]["AI_term"] = 'PseudoDiff' - capabilities[model]["supports_simultaneous_AI_sampling"] = DAQmxGetDevAISimultaneousSamplingSupported(name) - - capabilities[model]["ports"] = {} - ports = DAQmxGetDevDOPorts(name) - chans = DAQmxGetDevDOLines(name) - for port in ports: - if '_' in port: - # Ignore the alternate port names such as 'port0_32' that allow using two or - # more ports together as a single, larger one: - continue - port_info = {} - capabilities[model]["ports"][port] = port_info - port_chans = [chan for chan in chans if chan.split('/')[0] == port] - port_info['num_lines'] = len(port_chans) - if capabilities[model]["supports_buffered_DO"]: - port_info['supports_buffered'] = port_supports_buffered(name, port) + if capabilities[model]["num_AI"] > 0: + if capabilities[model]["AI_term"] == 'PseudoDiff': + capabilities[model]["AI_start_delay_ticks"] = AI_filter_delay(name) + capabilities[model]["AI_start_delay"] = None + else: + capabilities[model]["AI_start_delay"] = AI_start_delay(name) else: - port_info['supports_buffered'] = False - - capabilities[model]["num_CI"] = len(DAQmxGetDevCIPhysicalChans(name)) - supports_semiperiod = supports_semiperiod_measurement(name) - capabilities[model]["supports_semiperiod_measurement"] = supports_semiperiod - if capabilities[model]["num_CI"] > 0 and supports_semiperiod: - min_semiperiod_measurement = get_min_semiperiod_measurement(name) - else: - min_semiperiod_measurement = None - capabilities[model]["min_semiperiod_measurement"] = min_semiperiod_measurement - - if capabilities[model]['num_AO'] > 0: - AO_ranges = [] - raw_limits = DAQmxGetDevAOVoltageRngs(name) - for i in range(0, len(raw_limits), 2): - Vmin, Vmax = raw_limits[i], raw_limits[i + 1] - AO_ranges.append([Vmin, Vmax]) - # Find range with the largest maximum voltage and use that: - Vmin, Vmax = max(AO_ranges, key=lambda range: range[1]) - # Confirm that no other range has a voltage lower than Vmin, - # since if it does, this violates our assumptions and things might not - # be as simple as having a single range: - assert min(AO_ranges)[0] >= Vmin - capabilities[model]["AO_range"] = [Vmin, Vmax] - else: - capabilities[model]["AO_range"] = None - - if capabilities[model]['num_AI'] > 0: - AI_ranges = [] - raw_limits = DAQmxGetDevAIVoltageRngs(name) - for i in range(0, len(raw_limits), 2): - Vmin, Vmax = raw_limits[i], raw_limits[i + 1] - AI_ranges.append([Vmin, Vmax]) - # Find range with the largest maximum voltage and use that: - Vmin_raw, Vmax_raw = max(AI_ranges, key=lambda range: range[1]) - # Confirm that no other range has a voltage lower than Vmin, - # since if it does, this violates our assumptions and things might not - # be as simple as having a single range: - assert min(AI_ranges)[0] >= Vmin_raw - capabilities[model]["AI_range_Diff"] = [Vmin_raw, Vmax_raw] - if 'RSE' in capabilities[model]["AI_term_cfg"]['ai0']: - # Now limit to non-differential inputs (if available), which may have lower ranges - AI_ranges = supported_AI_ranges_for_non_differential_input(name, AI_ranges) - # Find RSE range with the largest maximum voltage and use that: - Vmin, Vmax = max(AI_ranges, key=lambda range: range[1]) - assert min(AI_ranges)[0] >= Vmin - capabilities[model]["AI_range"] = [Vmin, Vmax] - else: - capabilities[model]["AI_range"] = None - capabilities[model]["AI_range_Diff"] = None - - if capabilities[model]["num_AI"] > 0: - if capabilities[model]["AI_term"] == 'PseudoDiff': - capabilities[model]["AI_start_delay_ticks"] = AI_filter_delay(name) capabilities[model]["AI_start_delay"] = None - else: - capabilities[model]["AI_start_delay"] = AI_start_delay(name) - else: - capabilities[model]["AI_start_delay"] = None with open(CAPABILITIES_FILE, 'w', newline='\n') as f: From 2f5393c270eb34fa67f2d806ff1ad722ad16e032 Mon Sep 17 00:00:00 2001 From: David Meyer Date: Mon, 8 Nov 2021 15:44:15 -0500 Subject: [PATCH 13/19] Update existing capabilities.json and pre-generated models with new functionality for AI termination configuration. Note, this commit also sorts out #67. --- .../NI_DAQmx/models/NI_PCI_6251.py | 21 + .../NI_DAQmx/models/NI_PCI_6534.py | 1 + .../NI_DAQmx/models/NI_PCI_6713.py | 1 + .../NI_DAQmx/models/NI_PCI_6733.py | 1 + .../NI_DAQmx/models/NI_PCI_DIO_32HS.py | 1 + .../NI_DAQmx/models/NI_PCIe_6343.py | 94 ++ .../NI_DAQmx/models/NI_PCIe_6363.py | 37 + .../NI_DAQmx/models/NI_PCIe_6738.py | 1 + .../NI_DAQmx/models/NI_PXI_6733.py | 1 + .../NI_DAQmx/models/NI_PXIe_6361.py | 21 + .../NI_DAQmx/models/NI_PXIe_6363.py | 94 ++ .../NI_DAQmx/models/NI_PXIe_6535.py | 1 + .../NI_DAQmx/models/NI_PXIe_6738.py | 1 + .../NI_DAQmx/models/NI_USB_6008.py | 13 + .../NI_DAQmx/models/NI_USB_6229.py | 37 + .../NI_DAQmx/models/NI_USB_6343.py | 37 + .../NI_DAQmx/models/NI_USB_6366.py | 2 + .../NI_DAQmx/models/capabilities.json | 1212 +++++++++++++++-- 18 files changed, 1488 insertions(+), 88 deletions(-) create mode 100644 labscript_devices/NI_DAQmx/models/NI_PCIe_6343.py create mode 100644 labscript_devices/NI_DAQmx/models/NI_PXIe_6363.py diff --git a/labscript_devices/NI_DAQmx/models/NI_PCI_6251.py b/labscript_devices/NI_DAQmx/models/NI_PCI_6251.py index e7587717..6d29fa8b 100644 --- a/labscript_devices/NI_DAQmx/models/NI_PCI_6251.py +++ b/labscript_devices/NI_DAQmx/models/NI_PCI_6251.py @@ -25,7 +25,27 @@ #: CAPABILITIES = { 'AI_range': [-10.0, 10.0], + 'AI_range_Diff': [-10.0, 10.0], 'AI_start_delay': 2.5e-07, + 'AI_term': 'RSE', + 'AI_term_cfg': { + 'ai0': ['RSE', 'NRSE', 'Diff'], + 'ai1': ['RSE', 'NRSE', 'Diff'], + 'ai10': ['RSE', 'NRSE'], + 'ai11': ['RSE', 'NRSE'], + 'ai12': ['RSE', 'NRSE'], + 'ai13': ['RSE', 'NRSE'], + 'ai14': ['RSE', 'NRSE'], + 'ai15': ['RSE', 'NRSE'], + 'ai2': ['RSE', 'NRSE', 'Diff'], + 'ai3': ['RSE', 'NRSE', 'Diff'], + 'ai4': ['RSE', 'NRSE', 'Diff'], + 'ai5': ['RSE', 'NRSE', 'Diff'], + 'ai6': ['RSE', 'NRSE', 'Diff'], + 'ai7': ['RSE', 'NRSE', 'Diff'], + 'ai8': ['RSE', 'NRSE'], + 'ai9': ['RSE', 'NRSE'], + }, 'AO_range': [-10.0, 10.0], 'max_AI_multi_chan_rate': 1000000.0, 'max_AI_single_chan_rate': 1250000.0, @@ -43,6 +63,7 @@ 'supports_buffered_AO': True, 'supports_buffered_DO': True, 'supports_semiperiod_measurement': True, + 'supports_simultaneous_AI_sampling': False, } diff --git a/labscript_devices/NI_DAQmx/models/NI_PCI_6534.py b/labscript_devices/NI_DAQmx/models/NI_PCI_6534.py index c0b7f9f0..e0d15dec 100644 --- a/labscript_devices/NI_DAQmx/models/NI_PCI_6534.py +++ b/labscript_devices/NI_DAQmx/models/NI_PCI_6534.py @@ -25,6 +25,7 @@ #: CAPABILITIES = { 'AI_range': None, + 'AI_range_Diff': None, 'AI_start_delay': None, 'AO_range': None, 'max_AI_multi_chan_rate': None, diff --git a/labscript_devices/NI_DAQmx/models/NI_PCI_6713.py b/labscript_devices/NI_DAQmx/models/NI_PCI_6713.py index 99361845..bf85ebc5 100644 --- a/labscript_devices/NI_DAQmx/models/NI_PCI_6713.py +++ b/labscript_devices/NI_DAQmx/models/NI_PCI_6713.py @@ -25,6 +25,7 @@ #: CAPABILITIES = { 'AI_range': None, + 'AI_range_Diff': None, 'AI_start_delay': None, 'AO_range': [-10.0, 10.0], 'max_AI_multi_chan_rate': None, diff --git a/labscript_devices/NI_DAQmx/models/NI_PCI_6733.py b/labscript_devices/NI_DAQmx/models/NI_PCI_6733.py index 234e3f09..7a64e3de 100644 --- a/labscript_devices/NI_DAQmx/models/NI_PCI_6733.py +++ b/labscript_devices/NI_DAQmx/models/NI_PCI_6733.py @@ -25,6 +25,7 @@ #: CAPABILITIES = { 'AI_range': None, + 'AI_range_Diff': None, 'AI_start_delay': None, 'AO_range': [-10.0, 10.0], 'max_AI_multi_chan_rate': None, diff --git a/labscript_devices/NI_DAQmx/models/NI_PCI_DIO_32HS.py b/labscript_devices/NI_DAQmx/models/NI_PCI_DIO_32HS.py index 6f297f36..be69c201 100644 --- a/labscript_devices/NI_DAQmx/models/NI_PCI_DIO_32HS.py +++ b/labscript_devices/NI_DAQmx/models/NI_PCI_DIO_32HS.py @@ -25,6 +25,7 @@ #: CAPABILITIES = { 'AI_range': None, + 'AI_range_Diff': None, 'AI_start_delay': None, 'AO_range': None, 'max_AI_multi_chan_rate': None, diff --git a/labscript_devices/NI_DAQmx/models/NI_PCIe_6343.py b/labscript_devices/NI_DAQmx/models/NI_PCIe_6343.py new file mode 100644 index 00000000..599f505c --- /dev/null +++ b/labscript_devices/NI_DAQmx/models/NI_PCIe_6343.py @@ -0,0 +1,94 @@ +##################################################################### +# # +# /NI_DAQmx/models/_subclass_template.py # +# # +# Copyright 2018, Christopher Billington # +# # +# This file is part of the module labscript_devices, in the # +# labscript suite (see http://labscriptsuite.org), and is # +# licensed under the Simplified BSD License. See the license.txt # +# file in the root of the project for the full license. # +# # +##################################################################### + +##################################################################### +# WARNING # +# # +# This file is auto-generated, any modifications may be # +# overwritten. See README.txt in this folder for details # +# # +##################################################################### + + +from labscript_devices.NI_DAQmx.labscript_devices import NI_DAQmx + +#: +CAPABILITIES = { + 'AI_range': [-10.0, 10.0], + 'AI_range_Diff': [-10.0, 10.0], + 'AI_start_delay': 7e-08, + 'AI_term': 'RSE', + 'AI_term_cfg': { + 'ai0': ['RSE', 'NRSE', 'Diff'], + 'ai1': ['RSE', 'NRSE', 'Diff'], + 'ai10': ['RSE', 'NRSE'], + 'ai11': ['RSE', 'NRSE'], + 'ai12': ['RSE', 'NRSE'], + 'ai13': ['RSE', 'NRSE'], + 'ai14': ['RSE', 'NRSE'], + 'ai15': ['RSE', 'NRSE'], + 'ai16': ['RSE', 'NRSE', 'Diff'], + 'ai17': ['RSE', 'NRSE', 'Diff'], + 'ai18': ['RSE', 'NRSE', 'Diff'], + 'ai19': ['RSE', 'NRSE', 'Diff'], + 'ai2': ['RSE', 'NRSE', 'Diff'], + 'ai20': ['RSE', 'NRSE', 'Diff'], + 'ai21': ['RSE', 'NRSE', 'Diff'], + 'ai22': ['RSE', 'NRSE', 'Diff'], + 'ai23': ['RSE', 'NRSE', 'Diff'], + 'ai24': ['RSE', 'NRSE'], + 'ai25': ['RSE', 'NRSE'], + 'ai26': ['RSE', 'NRSE'], + 'ai27': ['RSE', 'NRSE'], + 'ai28': ['RSE', 'NRSE'], + 'ai29': ['RSE', 'NRSE'], + 'ai3': ['RSE', 'NRSE', 'Diff'], + 'ai30': ['RSE', 'NRSE'], + 'ai31': ['RSE', 'NRSE'], + 'ai4': ['RSE', 'NRSE', 'Diff'], + 'ai5': ['RSE', 'NRSE', 'Diff'], + 'ai6': ['RSE', 'NRSE', 'Diff'], + 'ai7': ['RSE', 'NRSE', 'Diff'], + 'ai8': ['RSE', 'NRSE'], + 'ai9': ['RSE', 'NRSE'], + }, + 'AO_range': [-10.0, 10.0], + 'max_AI_multi_chan_rate': 500000.0, + 'max_AI_single_chan_rate': 500000.0, + 'max_AO_sample_rate': 917431.1926605505, + 'max_DO_sample_rate': 1000000.0, + 'min_semiperiod_measurement': 1e-07, + 'num_AI': 32, + 'num_AO': 4, + 'num_CI': 4, + 'ports': { + 'port0': {'num_lines': 32, 'supports_buffered': True}, + 'port1': {'num_lines': 8, 'supports_buffered': False}, + 'port2': {'num_lines': 8, 'supports_buffered': False}, + }, + 'supports_buffered_AO': True, + 'supports_buffered_DO': True, + 'supports_semiperiod_measurement': True, + 'supports_simultaneous_AI_sampling': False, +} + + +class NI_PCIe_6343(NI_DAQmx): + description = 'NI-PCIe-6343' + + def __init__(self, *args, **kwargs): + """Class for NI-PCIe-6343""" + # Any provided kwargs take precedent over capabilities + combined_kwargs = CAPABILITIES.copy() + combined_kwargs.update(kwargs) + NI_DAQmx.__init__(self, *args, **combined_kwargs) diff --git a/labscript_devices/NI_DAQmx/models/NI_PCIe_6363.py b/labscript_devices/NI_DAQmx/models/NI_PCIe_6363.py index 8155ce02..d3c746ab 100644 --- a/labscript_devices/NI_DAQmx/models/NI_PCIe_6363.py +++ b/labscript_devices/NI_DAQmx/models/NI_PCIe_6363.py @@ -25,7 +25,43 @@ #: CAPABILITIES = { 'AI_range': [-10.0, 10.0], + 'AI_range_Diff': [-10.0, 10.0], 'AI_start_delay': 7e-08, + 'AI_term': 'RSE', + 'AI_term_cfg': { + 'ai0': ['RSE', 'NRSE', 'Diff'], + 'ai1': ['RSE', 'NRSE', 'Diff'], + 'ai10': ['RSE', 'NRSE'], + 'ai11': ['RSE', 'NRSE'], + 'ai12': ['RSE', 'NRSE'], + 'ai13': ['RSE', 'NRSE'], + 'ai14': ['RSE', 'NRSE'], + 'ai15': ['RSE', 'NRSE'], + 'ai16': ['RSE', 'NRSE', 'Diff'], + 'ai17': ['RSE', 'NRSE', 'Diff'], + 'ai18': ['RSE', 'NRSE', 'Diff'], + 'ai19': ['RSE', 'NRSE', 'Diff'], + 'ai2': ['RSE', 'NRSE', 'Diff'], + 'ai20': ['RSE', 'NRSE', 'Diff'], + 'ai21': ['RSE', 'NRSE', 'Diff'], + 'ai22': ['RSE', 'NRSE', 'Diff'], + 'ai23': ['RSE', 'NRSE', 'Diff'], + 'ai24': ['RSE', 'NRSE'], + 'ai25': ['RSE', 'NRSE'], + 'ai26': ['RSE', 'NRSE'], + 'ai27': ['RSE', 'NRSE'], + 'ai28': ['RSE', 'NRSE'], + 'ai29': ['RSE', 'NRSE'], + 'ai3': ['RSE', 'NRSE', 'Diff'], + 'ai30': ['RSE', 'NRSE'], + 'ai31': ['RSE', 'NRSE'], + 'ai4': ['RSE', 'NRSE', 'Diff'], + 'ai5': ['RSE', 'NRSE', 'Diff'], + 'ai6': ['RSE', 'NRSE', 'Diff'], + 'ai7': ['RSE', 'NRSE', 'Diff'], + 'ai8': ['RSE', 'NRSE'], + 'ai9': ['RSE', 'NRSE'], + }, 'AO_range': [-10.0, 10.0], 'max_AI_multi_chan_rate': 1000000.0, 'max_AI_single_chan_rate': 2000000.0, @@ -43,6 +79,7 @@ 'supports_buffered_AO': True, 'supports_buffered_DO': True, 'supports_semiperiod_measurement': True, + 'supports_simultaneous_AI_sampling': False, } diff --git a/labscript_devices/NI_DAQmx/models/NI_PCIe_6738.py b/labscript_devices/NI_DAQmx/models/NI_PCIe_6738.py index fb592d21..970ff1c9 100644 --- a/labscript_devices/NI_DAQmx/models/NI_PCIe_6738.py +++ b/labscript_devices/NI_DAQmx/models/NI_PCIe_6738.py @@ -25,6 +25,7 @@ #: CAPABILITIES = { 'AI_range': None, + 'AI_range_Diff': None, 'AI_start_delay': None, 'AO_range': [-10.0, 10.0], 'max_AI_multi_chan_rate': None, diff --git a/labscript_devices/NI_DAQmx/models/NI_PXI_6733.py b/labscript_devices/NI_DAQmx/models/NI_PXI_6733.py index 74ff7215..a98a7dec 100644 --- a/labscript_devices/NI_DAQmx/models/NI_PXI_6733.py +++ b/labscript_devices/NI_DAQmx/models/NI_PXI_6733.py @@ -25,6 +25,7 @@ #: CAPABILITIES = { 'AI_range': None, + 'AI_range_Diff': None, 'AI_start_delay': None, 'AO_range': [-10.0, 10.0], 'max_AI_multi_chan_rate': None, diff --git a/labscript_devices/NI_DAQmx/models/NI_PXIe_6361.py b/labscript_devices/NI_DAQmx/models/NI_PXIe_6361.py index 7b88180a..1b33db33 100644 --- a/labscript_devices/NI_DAQmx/models/NI_PXIe_6361.py +++ b/labscript_devices/NI_DAQmx/models/NI_PXIe_6361.py @@ -25,7 +25,27 @@ #: CAPABILITIES = { 'AI_range': [-10.0, 10.0], + 'AI_range_Diff': [-10.0, 10.0], 'AI_start_delay': 7e-08, + 'AI_term': 'RSE', + 'AI_term_cfg': { + 'ai0': ['RSE', 'NRSE', 'Diff'], + 'ai1': ['RSE', 'NRSE', 'Diff'], + 'ai10': ['RSE', 'NRSE'], + 'ai11': ['RSE', 'NRSE'], + 'ai12': ['RSE', 'NRSE'], + 'ai13': ['RSE', 'NRSE'], + 'ai14': ['RSE', 'NRSE'], + 'ai15': ['RSE', 'NRSE'], + 'ai2': ['RSE', 'NRSE', 'Diff'], + 'ai3': ['RSE', 'NRSE', 'Diff'], + 'ai4': ['RSE', 'NRSE', 'Diff'], + 'ai5': ['RSE', 'NRSE', 'Diff'], + 'ai6': ['RSE', 'NRSE', 'Diff'], + 'ai7': ['RSE', 'NRSE', 'Diff'], + 'ai8': ['RSE', 'NRSE'], + 'ai9': ['RSE', 'NRSE'], + }, 'AO_range': [-10.0, 10.0], 'max_AI_multi_chan_rate': 1000000.0, 'max_AI_single_chan_rate': 2000000.0, @@ -43,6 +63,7 @@ 'supports_buffered_AO': True, 'supports_buffered_DO': True, 'supports_semiperiod_measurement': True, + 'supports_simultaneous_AI_sampling': False, } diff --git a/labscript_devices/NI_DAQmx/models/NI_PXIe_6363.py b/labscript_devices/NI_DAQmx/models/NI_PXIe_6363.py new file mode 100644 index 00000000..1624350a --- /dev/null +++ b/labscript_devices/NI_DAQmx/models/NI_PXIe_6363.py @@ -0,0 +1,94 @@ +##################################################################### +# # +# /NI_DAQmx/models/_subclass_template.py # +# # +# Copyright 2018, Christopher Billington # +# # +# This file is part of the module labscript_devices, in the # +# labscript suite (see http://labscriptsuite.org), and is # +# licensed under the Simplified BSD License. See the license.txt # +# file in the root of the project for the full license. # +# # +##################################################################### + +##################################################################### +# WARNING # +# # +# This file is auto-generated, any modifications may be # +# overwritten. See README.txt in this folder for details # +# # +##################################################################### + + +from labscript_devices.NI_DAQmx.labscript_devices import NI_DAQmx + +#: +CAPABILITIES = { + 'AI_range': [-10.0, 10.0], + 'AI_range_Diff': [-10.0, 10.0], + 'AI_start_delay': 7e-08, + 'AI_term': 'RSE', + 'AI_term_cfg': { + 'ai0': ['RSE', 'NRSE', 'Diff'], + 'ai1': ['RSE', 'NRSE', 'Diff'], + 'ai10': ['RSE', 'NRSE'], + 'ai11': ['RSE', 'NRSE'], + 'ai12': ['RSE', 'NRSE'], + 'ai13': ['RSE', 'NRSE'], + 'ai14': ['RSE', 'NRSE'], + 'ai15': ['RSE', 'NRSE'], + 'ai16': ['RSE', 'NRSE', 'Diff'], + 'ai17': ['RSE', 'NRSE', 'Diff'], + 'ai18': ['RSE', 'NRSE', 'Diff'], + 'ai19': ['RSE', 'NRSE', 'Diff'], + 'ai2': ['RSE', 'NRSE', 'Diff'], + 'ai20': ['RSE', 'NRSE', 'Diff'], + 'ai21': ['RSE', 'NRSE', 'Diff'], + 'ai22': ['RSE', 'NRSE', 'Diff'], + 'ai23': ['RSE', 'NRSE', 'Diff'], + 'ai24': ['RSE', 'NRSE'], + 'ai25': ['RSE', 'NRSE'], + 'ai26': ['RSE', 'NRSE'], + 'ai27': ['RSE', 'NRSE'], + 'ai28': ['RSE', 'NRSE'], + 'ai29': ['RSE', 'NRSE'], + 'ai3': ['RSE', 'NRSE', 'Diff'], + 'ai30': ['RSE', 'NRSE'], + 'ai31': ['RSE', 'NRSE'], + 'ai4': ['RSE', 'NRSE', 'Diff'], + 'ai5': ['RSE', 'NRSE', 'Diff'], + 'ai6': ['RSE', 'NRSE', 'Diff'], + 'ai7': ['RSE', 'NRSE', 'Diff'], + 'ai8': ['RSE', 'NRSE'], + 'ai9': ['RSE', 'NRSE'], + }, + 'AO_range': [-10.0, 10.0], + 'max_AI_multi_chan_rate': 1000000.0, + 'max_AI_single_chan_rate': 2000000.0, + 'max_AO_sample_rate': 2857142.8571428573, + 'max_DO_sample_rate': 10000000.0, + 'min_semiperiod_measurement': 1e-07, + 'num_AI': 32, + 'num_AO': 4, + 'num_CI': 4, + 'ports': { + 'port0': {'num_lines': 32, 'supports_buffered': True}, + 'port1': {'num_lines': 8, 'supports_buffered': False}, + 'port2': {'num_lines': 8, 'supports_buffered': False}, + }, + 'supports_buffered_AO': True, + 'supports_buffered_DO': True, + 'supports_semiperiod_measurement': True, + 'supports_simultaneous_AI_sampling': False, +} + + +class NI_PXIe_6363(NI_DAQmx): + description = 'NI-PXIe-6363' + + def __init__(self, *args, **kwargs): + """Class for NI-PXIe-6363""" + # Any provided kwargs take precedent over capabilities + combined_kwargs = CAPABILITIES.copy() + combined_kwargs.update(kwargs) + NI_DAQmx.__init__(self, *args, **combined_kwargs) diff --git a/labscript_devices/NI_DAQmx/models/NI_PXIe_6535.py b/labscript_devices/NI_DAQmx/models/NI_PXIe_6535.py index a71a4322..192ba41d 100644 --- a/labscript_devices/NI_DAQmx/models/NI_PXIe_6535.py +++ b/labscript_devices/NI_DAQmx/models/NI_PXIe_6535.py @@ -25,6 +25,7 @@ #: CAPABILITIES = { 'AI_range': None, + 'AI_range_Diff': None, 'AI_start_delay': None, 'AO_range': None, 'max_AI_multi_chan_rate': None, diff --git a/labscript_devices/NI_DAQmx/models/NI_PXIe_6738.py b/labscript_devices/NI_DAQmx/models/NI_PXIe_6738.py index 10b93ec5..713d1faf 100644 --- a/labscript_devices/NI_DAQmx/models/NI_PXIe_6738.py +++ b/labscript_devices/NI_DAQmx/models/NI_PXIe_6738.py @@ -25,6 +25,7 @@ #: CAPABILITIES = { 'AI_range': None, + 'AI_range_Diff': None, 'AI_start_delay': None, 'AO_range': [-10.0, 10.0], 'max_AI_multi_chan_rate': None, diff --git a/labscript_devices/NI_DAQmx/models/NI_USB_6008.py b/labscript_devices/NI_DAQmx/models/NI_USB_6008.py index 4a0b4714..c49532fc 100644 --- a/labscript_devices/NI_DAQmx/models/NI_USB_6008.py +++ b/labscript_devices/NI_DAQmx/models/NI_USB_6008.py @@ -25,7 +25,19 @@ #: CAPABILITIES = { 'AI_range': [-10.0, 10.0], + 'AI_range_Diff': [-20.0, 20.0], 'AI_start_delay': 8.333333333333334e-08, + 'AI_term': 'RSE', + 'AI_term_cfg': { + 'ai0': ['RSE', 'Diff'], + 'ai1': ['RSE', 'Diff'], + 'ai2': ['RSE', 'Diff'], + 'ai3': ['RSE', 'Diff'], + 'ai4': ['RSE'], + 'ai5': ['RSE'], + 'ai6': ['RSE'], + 'ai7': ['RSE'], + }, 'AO_range': [0.0, 5.0], 'max_AI_multi_chan_rate': 10000.0, 'max_AI_single_chan_rate': 10000.0, @@ -42,6 +54,7 @@ 'supports_buffered_AO': False, 'supports_buffered_DO': False, 'supports_semiperiod_measurement': False, + 'supports_simultaneous_AI_sampling': False, } diff --git a/labscript_devices/NI_DAQmx/models/NI_USB_6229.py b/labscript_devices/NI_DAQmx/models/NI_USB_6229.py index b17bf1b5..8ab86756 100644 --- a/labscript_devices/NI_DAQmx/models/NI_USB_6229.py +++ b/labscript_devices/NI_DAQmx/models/NI_USB_6229.py @@ -25,7 +25,43 @@ #: CAPABILITIES = { 'AI_range': [-10.0, 10.0], + 'AI_range_Diff': [-10.0, 10.0], 'AI_start_delay': 2.5e-07, + 'AI_term': 'RSE', + 'AI_term_cfg': { + 'ai0': ['RSE', 'NRSE', 'Diff'], + 'ai1': ['RSE', 'NRSE', 'Diff'], + 'ai10': ['RSE', 'NRSE'], + 'ai11': ['RSE', 'NRSE'], + 'ai12': ['RSE', 'NRSE'], + 'ai13': ['RSE', 'NRSE'], + 'ai14': ['RSE', 'NRSE'], + 'ai15': ['RSE', 'NRSE'], + 'ai16': ['RSE', 'NRSE', 'Diff'], + 'ai17': ['RSE', 'NRSE', 'Diff'], + 'ai18': ['RSE', 'NRSE', 'Diff'], + 'ai19': ['RSE', 'NRSE', 'Diff'], + 'ai2': ['RSE', 'NRSE', 'Diff'], + 'ai20': ['RSE', 'NRSE', 'Diff'], + 'ai21': ['RSE', 'NRSE', 'Diff'], + 'ai22': ['RSE', 'NRSE', 'Diff'], + 'ai23': ['RSE', 'NRSE', 'Diff'], + 'ai24': ['RSE', 'NRSE'], + 'ai25': ['RSE', 'NRSE'], + 'ai26': ['RSE', 'NRSE'], + 'ai27': ['RSE', 'NRSE'], + 'ai28': ['RSE', 'NRSE'], + 'ai29': ['RSE', 'NRSE'], + 'ai3': ['RSE', 'NRSE', 'Diff'], + 'ai30': ['RSE', 'NRSE'], + 'ai31': ['RSE', 'NRSE'], + 'ai4': ['RSE', 'NRSE', 'Diff'], + 'ai5': ['RSE', 'NRSE', 'Diff'], + 'ai6': ['RSE', 'NRSE', 'Diff'], + 'ai7': ['RSE', 'NRSE', 'Diff'], + 'ai8': ['RSE', 'NRSE'], + 'ai9': ['RSE', 'NRSE'], + }, 'AO_range': [-10.0, 10.0], 'max_AI_multi_chan_rate': 250000.0, 'max_AI_single_chan_rate': 250000.0, @@ -43,6 +79,7 @@ 'supports_buffered_AO': True, 'supports_buffered_DO': True, 'supports_semiperiod_measurement': True, + 'supports_simultaneous_AI_sampling': False, } diff --git a/labscript_devices/NI_DAQmx/models/NI_USB_6343.py b/labscript_devices/NI_DAQmx/models/NI_USB_6343.py index 1d38e471..7279fac2 100644 --- a/labscript_devices/NI_DAQmx/models/NI_USB_6343.py +++ b/labscript_devices/NI_DAQmx/models/NI_USB_6343.py @@ -25,7 +25,43 @@ #: CAPABILITIES = { 'AI_range': [-10.0, 10.0], + 'AI_range_Diff': [-10.0, 10.0], 'AI_start_delay': 7e-08, + 'AI_term': 'RSE', + 'AI_term_cfg': { + 'ai0': ['RSE', 'NRSE', 'Diff'], + 'ai1': ['RSE', 'NRSE', 'Diff'], + 'ai10': ['RSE', 'NRSE'], + 'ai11': ['RSE', 'NRSE'], + 'ai12': ['RSE', 'NRSE'], + 'ai13': ['RSE', 'NRSE'], + 'ai14': ['RSE', 'NRSE'], + 'ai15': ['RSE', 'NRSE'], + 'ai16': ['RSE', 'NRSE', 'Diff'], + 'ai17': ['RSE', 'NRSE', 'Diff'], + 'ai18': ['RSE', 'NRSE', 'Diff'], + 'ai19': ['RSE', 'NRSE', 'Diff'], + 'ai2': ['RSE', 'NRSE', 'Diff'], + 'ai20': ['RSE', 'NRSE', 'Diff'], + 'ai21': ['RSE', 'NRSE', 'Diff'], + 'ai22': ['RSE', 'NRSE', 'Diff'], + 'ai23': ['RSE', 'NRSE', 'Diff'], + 'ai24': ['RSE', 'NRSE'], + 'ai25': ['RSE', 'NRSE'], + 'ai26': ['RSE', 'NRSE'], + 'ai27': ['RSE', 'NRSE'], + 'ai28': ['RSE', 'NRSE'], + 'ai29': ['RSE', 'NRSE'], + 'ai3': ['RSE', 'NRSE', 'Diff'], + 'ai30': ['RSE', 'NRSE'], + 'ai31': ['RSE', 'NRSE'], + 'ai4': ['RSE', 'NRSE', 'Diff'], + 'ai5': ['RSE', 'NRSE', 'Diff'], + 'ai6': ['RSE', 'NRSE', 'Diff'], + 'ai7': ['RSE', 'NRSE', 'Diff'], + 'ai8': ['RSE', 'NRSE'], + 'ai9': ['RSE', 'NRSE'], + }, 'AO_range': [-10.0, 10.0], 'max_AI_multi_chan_rate': 500000.0, 'max_AI_single_chan_rate': 500000.0, @@ -43,6 +79,7 @@ 'supports_buffered_AO': True, 'supports_buffered_DO': True, 'supports_semiperiod_measurement': True, + 'supports_simultaneous_AI_sampling': False, } diff --git a/labscript_devices/NI_DAQmx/models/NI_USB_6366.py b/labscript_devices/NI_DAQmx/models/NI_USB_6366.py index 4acc7ee3..8ed566ff 100644 --- a/labscript_devices/NI_DAQmx/models/NI_USB_6366.py +++ b/labscript_devices/NI_DAQmx/models/NI_USB_6366.py @@ -22,6 +22,7 @@ from labscript_devices.NI_DAQmx.labscript_devices import NI_DAQmx +#: CAPABILITIES = { 'AI_range': [-10.0, 10.0], 'AI_range_Diff': [-10.0, 10.0], @@ -62,6 +63,7 @@ class NI_USB_6366(NI_DAQmx): description = 'NI-USB-6366' def __init__(self, *args, **kwargs): + """Class for NI-USB-6366""" # Any provided kwargs take precedent over capabilities combined_kwargs = CAPABILITIES.copy() combined_kwargs.update(kwargs) diff --git a/labscript_devices/NI_DAQmx/models/capabilities.json b/labscript_devices/NI_DAQmx/models/capabilities.json index 8b67103b..ee5d34ca 100644 --- a/labscript_devices/NI_DAQmx/models/capabilities.json +++ b/labscript_devices/NI_DAQmx/models/capabilities.json @@ -4,7 +4,86 @@ -10.0, 10.0 ], + "AI_range_Diff": [ + -10.0, + 10.0 + ], "AI_start_delay": 2.5e-07, + "AI_term": "RSE", + "AI_term_cfg": { + "ai0": [ + "RSE", + "NRSE", + "Diff" + ], + "ai1": [ + "RSE", + "NRSE", + "Diff" + ], + "ai10": [ + "RSE", + "NRSE" + ], + "ai11": [ + "RSE", + "NRSE" + ], + "ai12": [ + "RSE", + "NRSE" + ], + "ai13": [ + "RSE", + "NRSE" + ], + "ai14": [ + "RSE", + "NRSE" + ], + "ai15": [ + "RSE", + "NRSE" + ], + "ai2": [ + "RSE", + "NRSE", + "Diff" + ], + "ai3": [ + "RSE", + "NRSE", + "Diff" + ], + "ai4": [ + "RSE", + "NRSE", + "Diff" + ], + "ai5": [ + "RSE", + "NRSE", + "Diff" + ], + "ai6": [ + "RSE", + "NRSE", + "Diff" + ], + "ai7": [ + "RSE", + "NRSE", + "Diff" + ], + "ai8": [ + "RSE", + "NRSE" + ], + "ai9": [ + "RSE", + "NRSE" + ] + }, "AO_range": [ -10.0, 10.0 @@ -33,10 +112,12 @@ }, "supports_buffered_AO": true, "supports_buffered_DO": true, - "supports_semiperiod_measurement": true + "supports_semiperiod_measurement": true, + "supports_simultaneous_AI_sampling": false }, "PCI-6534": { "AI_range": null, + "AI_range_Diff": null, "AI_start_delay": null, "AO_range": null, "max_AI_multi_chan_rate": null, @@ -79,6 +160,7 @@ }, "PCI-6713": { "AI_range": null, + "AI_range_Diff": null, "AI_start_delay": null, "AO_range": [ -10.0, @@ -104,6 +186,7 @@ }, "PCI-6733": { "AI_range": null, + "AI_range_Diff": null, "AI_start_delay": null, "AO_range": [ -10.0, @@ -129,6 +212,7 @@ }, "PCI-DIO-32HS": { "AI_range": null, + "AI_range_Diff": null, "AI_start_delay": null, "AO_range": null, "max_AI_multi_chan_rate": null, @@ -169,20 +253,171 @@ "supports_buffered_DO": true, "supports_semiperiod_measurement": false }, - "PCIe-6363": { + "PCIe-6343": { "AI_range": [ -10.0, 10.0 ], + "AI_range_Diff": [ + -10.0, + 10.0 + ], "AI_start_delay": 7e-08, + "AI_term": "RSE", + "AI_term_cfg": { + "ai0": [ + "RSE", + "NRSE", + "Diff" + ], + "ai1": [ + "RSE", + "NRSE", + "Diff" + ], + "ai10": [ + "RSE", + "NRSE" + ], + "ai11": [ + "RSE", + "NRSE" + ], + "ai12": [ + "RSE", + "NRSE" + ], + "ai13": [ + "RSE", + "NRSE" + ], + "ai14": [ + "RSE", + "NRSE" + ], + "ai15": [ + "RSE", + "NRSE" + ], + "ai16": [ + "RSE", + "NRSE", + "Diff" + ], + "ai17": [ + "RSE", + "NRSE", + "Diff" + ], + "ai18": [ + "RSE", + "NRSE", + "Diff" + ], + "ai19": [ + "RSE", + "NRSE", + "Diff" + ], + "ai2": [ + "RSE", + "NRSE", + "Diff" + ], + "ai20": [ + "RSE", + "NRSE", + "Diff" + ], + "ai21": [ + "RSE", + "NRSE", + "Diff" + ], + "ai22": [ + "RSE", + "NRSE", + "Diff" + ], + "ai23": [ + "RSE", + "NRSE", + "Diff" + ], + "ai24": [ + "RSE", + "NRSE" + ], + "ai25": [ + "RSE", + "NRSE" + ], + "ai26": [ + "RSE", + "NRSE" + ], + "ai27": [ + "RSE", + "NRSE" + ], + "ai28": [ + "RSE", + "NRSE" + ], + "ai29": [ + "RSE", + "NRSE" + ], + "ai3": [ + "RSE", + "NRSE", + "Diff" + ], + "ai30": [ + "RSE", + "NRSE" + ], + "ai31": [ + "RSE", + "NRSE" + ], + "ai4": [ + "RSE", + "NRSE", + "Diff" + ], + "ai5": [ + "RSE", + "NRSE", + "Diff" + ], + "ai6": [ + "RSE", + "NRSE", + "Diff" + ], + "ai7": [ + "RSE", + "NRSE", + "Diff" + ], + "ai8": [ + "RSE", + "NRSE" + ], + "ai9": [ + "RSE", + "NRSE" + ] + }, "AO_range": [ -10.0, 10.0 ], - "max_AI_multi_chan_rate": 1000000.0, - "max_AI_single_chan_rate": 2000000.0, - "max_AO_sample_rate": 2857142.8571428573, - "max_DO_sample_rate": 10000000.0, + "max_AI_multi_chan_rate": 500000.0, + "max_AI_single_chan_rate": 500000.0, + "max_AO_sample_rate": 917431.1926605505, + "max_DO_sample_rate": 1000000.0, "min_semiperiod_measurement": 1e-07, "num_AI": 32, "num_AO": 4, @@ -203,20 +438,210 @@ }, "supports_buffered_AO": true, "supports_buffered_DO": true, - "supports_semiperiod_measurement": true + "supports_semiperiod_measurement": true, + "supports_simultaneous_AI_sampling": false }, - "PCIe-6738": { - "AI_range": null, - "AI_start_delay": null, - "AO_range": [ + "PCIe-6363": { + "AI_range": [ -10.0, 10.0 ], - "max_AI_multi_chan_rate": null, - "max_AI_single_chan_rate": null, - "max_AO_sample_rate": 1000000.0, - "max_DO_sample_rate": 10000000.0, - "min_semiperiod_measurement": 1e-07, + "AI_range_Diff": [ + -10.0, + 10.0 + ], + "AI_start_delay": 7e-08, + "AI_term": "RSE", + "AI_term_cfg": { + "ai0": [ + "RSE", + "NRSE", + "Diff" + ], + "ai1": [ + "RSE", + "NRSE", + "Diff" + ], + "ai10": [ + "RSE", + "NRSE" + ], + "ai11": [ + "RSE", + "NRSE" + ], + "ai12": [ + "RSE", + "NRSE" + ], + "ai13": [ + "RSE", + "NRSE" + ], + "ai14": [ + "RSE", + "NRSE" + ], + "ai15": [ + "RSE", + "NRSE" + ], + "ai16": [ + "RSE", + "NRSE", + "Diff" + ], + "ai17": [ + "RSE", + "NRSE", + "Diff" + ], + "ai18": [ + "RSE", + "NRSE", + "Diff" + ], + "ai19": [ + "RSE", + "NRSE", + "Diff" + ], + "ai2": [ + "RSE", + "NRSE", + "Diff" + ], + "ai20": [ + "RSE", + "NRSE", + "Diff" + ], + "ai21": [ + "RSE", + "NRSE", + "Diff" + ], + "ai22": [ + "RSE", + "NRSE", + "Diff" + ], + "ai23": [ + "RSE", + "NRSE", + "Diff" + ], + "ai24": [ + "RSE", + "NRSE" + ], + "ai25": [ + "RSE", + "NRSE" + ], + "ai26": [ + "RSE", + "NRSE" + ], + "ai27": [ + "RSE", + "NRSE" + ], + "ai28": [ + "RSE", + "NRSE" + ], + "ai29": [ + "RSE", + "NRSE" + ], + "ai3": [ + "RSE", + "NRSE", + "Diff" + ], + "ai30": [ + "RSE", + "NRSE" + ], + "ai31": [ + "RSE", + "NRSE" + ], + "ai4": [ + "RSE", + "NRSE", + "Diff" + ], + "ai5": [ + "RSE", + "NRSE", + "Diff" + ], + "ai6": [ + "RSE", + "NRSE", + "Diff" + ], + "ai7": [ + "RSE", + "NRSE", + "Diff" + ], + "ai8": [ + "RSE", + "NRSE" + ], + "ai9": [ + "RSE", + "NRSE" + ] + }, + "AO_range": [ + -10.0, + 10.0 + ], + "max_AI_multi_chan_rate": 1000000.0, + "max_AI_single_chan_rate": 2000000.0, + "max_AO_sample_rate": 2857142.8571428573, + "max_DO_sample_rate": 10000000.0, + "min_semiperiod_measurement": 1e-07, + "num_AI": 32, + "num_AO": 4, + "num_CI": 4, + "ports": { + "port0": { + "num_lines": 32, + "supports_buffered": true + }, + "port1": { + "num_lines": 8, + "supports_buffered": false + }, + "port2": { + "num_lines": 8, + "supports_buffered": false + } + }, + "supports_buffered_AO": true, + "supports_buffered_DO": true, + "supports_semiperiod_measurement": true, + "supports_simultaneous_AI_sampling": false + }, + "PCIe-6738": { + "AI_range": null, + "AI_range_Diff": null, + "AI_start_delay": null, + "AO_range": [ + -10.0, + 10.0 + ], + "max_AI_multi_chan_rate": null, + "max_AI_single_chan_rate": null, + "max_AO_sample_rate": 1000000.0, + "max_DO_sample_rate": 10000000.0, + "min_semiperiod_measurement": 1e-07, "num_AI": 0, "num_AO": 32, "num_CI": 4, @@ -236,6 +661,7 @@ }, "PXI-6733": { "AI_range": null, + "AI_range_Diff": null, "AI_start_delay": null, "AO_range": [ -10.0, @@ -341,69 +767,338 @@ -10.0, 10.0 ], - "AI_start_delay": 7e-08, - "AO_range": [ + "AI_range_Diff": [ -10.0, 10.0 ], - "max_AI_multi_chan_rate": 1000000.0, - "max_AI_single_chan_rate": 2000000.0, - "max_AO_sample_rate": 2857142.8571428573, - "max_DO_sample_rate": 10000000.0, - "min_semiperiod_measurement": 1e-07, - "num_AI": 16, - "num_AO": 2, - "num_CI": 4, - "ports": { - "port0": { - "num_lines": 8, - "supports_buffered": true - }, - "port1": { - "num_lines": 8, - "supports_buffered": false - }, - "port2": { - "num_lines": 8, - "supports_buffered": false - } - }, - "supports_buffered_AO": true, - "supports_buffered_DO": true, - "supports_semiperiod_measurement": true - }, - "PXIe-6535": { - "AI_range": null, - "AI_start_delay": null, - "AO_range": null, - "max_AI_multi_chan_rate": null, - "max_AI_single_chan_rate": null, - "max_AO_sample_rate": null, - "max_DO_sample_rate": 10000000.0, - "min_semiperiod_measurement": null, - "num_AI": 0, - "num_AO": 0, - "num_CI": 0, - "ports": { - "port0": { - "num_lines": 8, - "supports_buffered": true - }, - "port1": { - "num_lines": 8, - "supports_buffered": true - }, - "port2": { - "num_lines": 8, - "supports_buffered": true - }, - "port3": { - "num_lines": 8, - "supports_buffered": true - }, - "port4": { - "num_lines": 6, - "supports_buffered": false + "AI_start_delay": 7e-08, + "AI_term": "RSE", + "AI_term_cfg": { + "ai0": [ + "RSE", + "NRSE", + "Diff" + ], + "ai1": [ + "RSE", + "NRSE", + "Diff" + ], + "ai10": [ + "RSE", + "NRSE" + ], + "ai11": [ + "RSE", + "NRSE" + ], + "ai12": [ + "RSE", + "NRSE" + ], + "ai13": [ + "RSE", + "NRSE" + ], + "ai14": [ + "RSE", + "NRSE" + ], + "ai15": [ + "RSE", + "NRSE" + ], + "ai2": [ + "RSE", + "NRSE", + "Diff" + ], + "ai3": [ + "RSE", + "NRSE", + "Diff" + ], + "ai4": [ + "RSE", + "NRSE", + "Diff" + ], + "ai5": [ + "RSE", + "NRSE", + "Diff" + ], + "ai6": [ + "RSE", + "NRSE", + "Diff" + ], + "ai7": [ + "RSE", + "NRSE", + "Diff" + ], + "ai8": [ + "RSE", + "NRSE" + ], + "ai9": [ + "RSE", + "NRSE" + ] + }, + "AO_range": [ + -10.0, + 10.0 + ], + "max_AI_multi_chan_rate": 1000000.0, + "max_AI_single_chan_rate": 2000000.0, + "max_AO_sample_rate": 2857142.8571428573, + "max_DO_sample_rate": 10000000.0, + "min_semiperiod_measurement": 1e-07, + "num_AI": 16, + "num_AO": 2, + "num_CI": 4, + "ports": { + "port0": { + "num_lines": 8, + "supports_buffered": true + }, + "port1": { + "num_lines": 8, + "supports_buffered": false + }, + "port2": { + "num_lines": 8, + "supports_buffered": false + } + }, + "supports_buffered_AO": true, + "supports_buffered_DO": true, + "supports_semiperiod_measurement": true, + "supports_simultaneous_AI_sampling": false + }, + "PXIe-6363": { + "AI_range": [ + -10.0, + 10.0 + ], + "AI_range_Diff": [ + -10.0, + 10.0 + ], + "AI_start_delay": 7e-08, + "AI_term": "RSE", + "AI_term_cfg": { + "ai0": [ + "RSE", + "NRSE", + "Diff" + ], + "ai1": [ + "RSE", + "NRSE", + "Diff" + ], + "ai10": [ + "RSE", + "NRSE" + ], + "ai11": [ + "RSE", + "NRSE" + ], + "ai12": [ + "RSE", + "NRSE" + ], + "ai13": [ + "RSE", + "NRSE" + ], + "ai14": [ + "RSE", + "NRSE" + ], + "ai15": [ + "RSE", + "NRSE" + ], + "ai16": [ + "RSE", + "NRSE", + "Diff" + ], + "ai17": [ + "RSE", + "NRSE", + "Diff" + ], + "ai18": [ + "RSE", + "NRSE", + "Diff" + ], + "ai19": [ + "RSE", + "NRSE", + "Diff" + ], + "ai2": [ + "RSE", + "NRSE", + "Diff" + ], + "ai20": [ + "RSE", + "NRSE", + "Diff" + ], + "ai21": [ + "RSE", + "NRSE", + "Diff" + ], + "ai22": [ + "RSE", + "NRSE", + "Diff" + ], + "ai23": [ + "RSE", + "NRSE", + "Diff" + ], + "ai24": [ + "RSE", + "NRSE" + ], + "ai25": [ + "RSE", + "NRSE" + ], + "ai26": [ + "RSE", + "NRSE" + ], + "ai27": [ + "RSE", + "NRSE" + ], + "ai28": [ + "RSE", + "NRSE" + ], + "ai29": [ + "RSE", + "NRSE" + ], + "ai3": [ + "RSE", + "NRSE", + "Diff" + ], + "ai30": [ + "RSE", + "NRSE" + ], + "ai31": [ + "RSE", + "NRSE" + ], + "ai4": [ + "RSE", + "NRSE", + "Diff" + ], + "ai5": [ + "RSE", + "NRSE", + "Diff" + ], + "ai6": [ + "RSE", + "NRSE", + "Diff" + ], + "ai7": [ + "RSE", + "NRSE", + "Diff" + ], + "ai8": [ + "RSE", + "NRSE" + ], + "ai9": [ + "RSE", + "NRSE" + ] + }, + "AO_range": [ + -10.0, + 10.0 + ], + "max_AI_multi_chan_rate": 1000000.0, + "max_AI_single_chan_rate": 2000000.0, + "max_AO_sample_rate": 2857142.8571428573, + "max_DO_sample_rate": 10000000.0, + "min_semiperiod_measurement": 1e-07, + "num_AI": 32, + "num_AO": 4, + "num_CI": 4, + "ports": { + "port0": { + "num_lines": 32, + "supports_buffered": true + }, + "port1": { + "num_lines": 8, + "supports_buffered": false + }, + "port2": { + "num_lines": 8, + "supports_buffered": false + } + }, + "supports_buffered_AO": true, + "supports_buffered_DO": true, + "supports_semiperiod_measurement": true, + "supports_simultaneous_AI_sampling": false + }, + "PXIe-6535": { + "AI_range": null, + "AI_range_Diff": null, + "AI_start_delay": null, + "AO_range": null, + "max_AI_multi_chan_rate": null, + "max_AI_single_chan_rate": null, + "max_AO_sample_rate": null, + "max_DO_sample_rate": 10000000.0, + "min_semiperiod_measurement": null, + "num_AI": 0, + "num_AO": 0, + "num_CI": 0, + "ports": { + "port0": { + "num_lines": 8, + "supports_buffered": true + }, + "port1": { + "num_lines": 8, + "supports_buffered": true + }, + "port2": { + "num_lines": 8, + "supports_buffered": true + }, + "port3": { + "num_lines": 8, + "supports_buffered": true + }, + "port4": { + "num_lines": 6, + "supports_buffered": false } }, "supports_buffered_AO": false, @@ -412,6 +1107,7 @@ }, "PXIe-6738": { "AI_range": null, + "AI_range_Diff": null, "AI_start_delay": null, "AO_range": [ -10.0, @@ -444,7 +1140,42 @@ -10.0, 10.0 ], + "AI_range_Diff": [ + -20.0, + 20.0 + ], "AI_start_delay": 8.333333333333334e-08, + "AI_term": "RSE", + "AI_term_cfg": { + "ai0": [ + "RSE", + "Diff" + ], + "ai1": [ + "RSE", + "Diff" + ], + "ai2": [ + "RSE", + "Diff" + ], + "ai3": [ + "RSE", + "Diff" + ], + "ai4": [ + "RSE" + ], + "ai5": [ + "RSE" + ], + "ai6": [ + "RSE" + ], + "ai7": [ + "RSE" + ] + }, "AO_range": [ 0.0, 5.0 @@ -467,16 +1198,168 @@ "supports_buffered": false } }, - "supports_buffered_AO": false, - "supports_buffered_DO": false, - "supports_semiperiod_measurement": false - }, - "USB-6229": { - "AI_range": [ - -10.0, - 10.0 - ], - "AI_start_delay": 2.5e-07, + "supports_buffered_AO": false, + "supports_buffered_DO": false, + "supports_semiperiod_measurement": false, + "supports_simultaneous_AI_sampling": false + }, + "USB-6229": { + "AI_range": [ + -10.0, + 10.0 + ], + "AI_range_Diff": [ + -10.0, + 10.0 + ], + "AI_start_delay": 2.5e-07, + "AI_term": "RSE", + "AI_term_cfg": { + "ai0": [ + "RSE", + "NRSE", + "Diff" + ], + "ai1": [ + "RSE", + "NRSE", + "Diff" + ], + "ai10": [ + "RSE", + "NRSE" + ], + "ai11": [ + "RSE", + "NRSE" + ], + "ai12": [ + "RSE", + "NRSE" + ], + "ai13": [ + "RSE", + "NRSE" + ], + "ai14": [ + "RSE", + "NRSE" + ], + "ai15": [ + "RSE", + "NRSE" + ], + "ai16": [ + "RSE", + "NRSE", + "Diff" + ], + "ai17": [ + "RSE", + "NRSE", + "Diff" + ], + "ai18": [ + "RSE", + "NRSE", + "Diff" + ], + "ai19": [ + "RSE", + "NRSE", + "Diff" + ], + "ai2": [ + "RSE", + "NRSE", + "Diff" + ], + "ai20": [ + "RSE", + "NRSE", + "Diff" + ], + "ai21": [ + "RSE", + "NRSE", + "Diff" + ], + "ai22": [ + "RSE", + "NRSE", + "Diff" + ], + "ai23": [ + "RSE", + "NRSE", + "Diff" + ], + "ai24": [ + "RSE", + "NRSE" + ], + "ai25": [ + "RSE", + "NRSE" + ], + "ai26": [ + "RSE", + "NRSE" + ], + "ai27": [ + "RSE", + "NRSE" + ], + "ai28": [ + "RSE", + "NRSE" + ], + "ai29": [ + "RSE", + "NRSE" + ], + "ai3": [ + "RSE", + "NRSE", + "Diff" + ], + "ai30": [ + "RSE", + "NRSE" + ], + "ai31": [ + "RSE", + "NRSE" + ], + "ai4": [ + "RSE", + "NRSE", + "Diff" + ], + "ai5": [ + "RSE", + "NRSE", + "Diff" + ], + "ai6": [ + "RSE", + "NRSE", + "Diff" + ], + "ai7": [ + "RSE", + "NRSE", + "Diff" + ], + "ai8": [ + "RSE", + "NRSE" + ], + "ai9": [ + "RSE", + "NRSE" + ] + }, "AO_range": [ -10.0, 10.0 @@ -505,14 +1388,166 @@ }, "supports_buffered_AO": true, "supports_buffered_DO": true, - "supports_semiperiod_measurement": true + "supports_semiperiod_measurement": true, + "supports_simultaneous_AI_sampling": false }, "USB-6343": { "AI_range": [ -10.0, 10.0 ], + "AI_range_Diff": [ + -10.0, + 10.0 + ], "AI_start_delay": 7e-08, + "AI_term": "RSE", + "AI_term_cfg": { + "ai0": [ + "RSE", + "NRSE", + "Diff" + ], + "ai1": [ + "RSE", + "NRSE", + "Diff" + ], + "ai10": [ + "RSE", + "NRSE" + ], + "ai11": [ + "RSE", + "NRSE" + ], + "ai12": [ + "RSE", + "NRSE" + ], + "ai13": [ + "RSE", + "NRSE" + ], + "ai14": [ + "RSE", + "NRSE" + ], + "ai15": [ + "RSE", + "NRSE" + ], + "ai16": [ + "RSE", + "NRSE", + "Diff" + ], + "ai17": [ + "RSE", + "NRSE", + "Diff" + ], + "ai18": [ + "RSE", + "NRSE", + "Diff" + ], + "ai19": [ + "RSE", + "NRSE", + "Diff" + ], + "ai2": [ + "RSE", + "NRSE", + "Diff" + ], + "ai20": [ + "RSE", + "NRSE", + "Diff" + ], + "ai21": [ + "RSE", + "NRSE", + "Diff" + ], + "ai22": [ + "RSE", + "NRSE", + "Diff" + ], + "ai23": [ + "RSE", + "NRSE", + "Diff" + ], + "ai24": [ + "RSE", + "NRSE" + ], + "ai25": [ + "RSE", + "NRSE" + ], + "ai26": [ + "RSE", + "NRSE" + ], + "ai27": [ + "RSE", + "NRSE" + ], + "ai28": [ + "RSE", + "NRSE" + ], + "ai29": [ + "RSE", + "NRSE" + ], + "ai3": [ + "RSE", + "NRSE", + "Diff" + ], + "ai30": [ + "RSE", + "NRSE" + ], + "ai31": [ + "RSE", + "NRSE" + ], + "ai4": [ + "RSE", + "NRSE", + "Diff" + ], + "ai5": [ + "RSE", + "NRSE", + "Diff" + ], + "ai6": [ + "RSE", + "NRSE", + "Diff" + ], + "ai7": [ + "RSE", + "NRSE", + "Diff" + ], + "ai8": [ + "RSE", + "NRSE" + ], + "ai9": [ + "RSE", + "NRSE" + ] + }, "AO_range": [ -10.0, 10.0 @@ -541,7 +1576,8 @@ }, "supports_buffered_AO": true, "supports_buffered_DO": true, - "supports_semiperiod_measurement": true + "supports_semiperiod_measurement": true, + "supports_simultaneous_AI_sampling": false }, "USB-6363": { "AI_range": [ From 7123c4cb2a21be0dbe69472b8c8038d269e7208d Mon Sep 17 00:00:00 2001 From: David Meyer Date: Mon, 8 Nov 2021 15:44:49 -0500 Subject: [PATCH 14/19] Update version tag of NI_DAQmx to 1.1.0 to denote semi-significant changes to functionality. --- labscript_devices/NI_DAQmx/labscript_devices.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/labscript_devices/NI_DAQmx/labscript_devices.py b/labscript_devices/NI_DAQmx/labscript_devices.py index 42c92396..8f655713 100644 --- a/labscript_devices/NI_DAQmx/labscript_devices.py +++ b/labscript_devices/NI_DAQmx/labscript_devices.py @@ -11,7 +11,7 @@ # # ##################################################################### -__version__ = '1.0.0' +__version__ = '1.1.0' from labscript import ( From 81b411d16d86b2ce5008ba25c1d2391a6aa54c29 Mon Sep 17 00:00:00 2001 From: David Meyer Date: Mon, 8 Nov 2021 16:11:21 -0500 Subject: [PATCH 15/19] Updating to be more clear about how AI_start_delay is calculated, particularly in the case of devices that use AI_start_delay_ticks. --- labscript_devices/NI_DAQmx/blacs_workers.py | 2 +- labscript_devices/NI_DAQmx/labscript_devices.py | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/labscript_devices/NI_DAQmx/blacs_workers.py b/labscript_devices/NI_DAQmx/blacs_workers.py index 384efa3f..61dff2fc 100644 --- a/labscript_devices/NI_DAQmx/blacs_workers.py +++ b/labscript_devices/NI_DAQmx/blacs_workers.py @@ -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: diff --git a/labscript_devices/NI_DAQmx/labscript_devices.py b/labscript_devices/NI_DAQmx/labscript_devices.py index 8f655713..2bb1fc8a 100644 --- a/labscript_devices/NI_DAQmx/labscript_devices.py +++ b/labscript_devices/NI_DAQmx/labscript_devices.py @@ -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, @@ -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 {} From 052a0f0c7c70bd9a5a11e70fcd79213ed2952659 Mon Sep 17 00:00:00 2001 From: David Meyer Date: Mon, 8 Nov 2021 16:17:18 -0500 Subject: [PATCH 16/19] Fix bad logic in determining where things occur. --- labscript_devices/NI_DAQmx/labscript_devices.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/labscript_devices/NI_DAQmx/labscript_devices.py b/labscript_devices/NI_DAQmx/labscript_devices.py index 2bb1fc8a..2c446a3f 100644 --- a/labscript_devices/NI_DAQmx/labscript_devices.py +++ b/labscript_devices/NI_DAQmx/labscript_devices.py @@ -236,9 +236,10 @@ def __init__( # Tell blacs_worker to use AI_start_delay_ticks to define delay self.start_delay_ticks = True else: - self.start_delay_ticks = False + raise LabscriptError("You have specified `AI_start_delay = None` but have not provided `AI_start_delay_ticks`.") else: - raise LabscriptError("You have specified `AI_start_delay = None` but have not provided `AI_start_delay_ticks`.") + # Tells blacs_worker to use AI_start_delay to define delay + self.start_delay_ticks = False self.num_AO = num_AO self.num_CI = num_CI self.ports = ports if ports is not None else {} From 9a4d0a1c3cc1e3a809984932f14ae3186f2dbaa2 Mon Sep 17 00:00:00 2001 From: David Meyer Date: Mon, 8 Nov 2021 16:19:26 -0500 Subject: [PATCH 17/19] Fix muffed indentation error. --- labscript_devices/NI_DAQmx/labscript_devices.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/labscript_devices/NI_DAQmx/labscript_devices.py b/labscript_devices/NI_DAQmx/labscript_devices.py index 2c446a3f..a6a37cdf 100644 --- a/labscript_devices/NI_DAQmx/labscript_devices.py +++ b/labscript_devices/NI_DAQmx/labscript_devices.py @@ -232,7 +232,7 @@ def __init__( if AI_term == 'Diff': self.AI_range = AI_range_Diff if AI_start_delay is None: - if AI_start_delay_ticks is not 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: From 7be741352a8bdf07d394b3ff05955c7a25507243 Mon Sep 17 00:00:00 2001 From: David Meyer Date: Mon, 29 Nov 2021 17:02:36 -0500 Subject: [PATCH 18/19] Updating docstrings. --- .../NI_DAQmx/labscript_devices.py | 4 ++-- .../NI_DAQmx/models/get_capabilities.py | 19 ++++++++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/labscript_devices/NI_DAQmx/labscript_devices.py b/labscript_devices/NI_DAQmx/labscript_devices.py index a6a37cdf..7efeb88d 100644 --- a/labscript_devices/NI_DAQmx/labscript_devices.py +++ b/labscript_devices/NI_DAQmx/labscript_devices.py @@ -145,7 +145,7 @@ def __init__( for DAQs that employ delta ADCs. AI_term (str, optional): Configures the analog input termination for all analog inputs. Must be supported by the device. Supported options are - `'RSE'`, `'Diff'`, and '`PseudoDiff'`. + `'RSE'`, `'NRSE'` `'Diff'`, and '`PseudoDiff'`. AI_term_cfg (dict, optional): Dictionary of analog input channels and their supported terminations. Best to use `get_capabilities.py` to introspect these. @@ -170,7 +170,7 @@ def __init__( buffered output supports_buffered_DO (bool, optional): True if digital outputs support buffered output - supports_semiperiod_measurement (bool, optional): True if deviec supports + supports_semiperiod_measurement (bool, optional): True if device supports semi-period measurements """ diff --git a/labscript_devices/NI_DAQmx/models/get_capabilities.py b/labscript_devices/NI_DAQmx/models/get_capabilities.py index c9f7ff33..a1672501 100644 --- a/labscript_devices/NI_DAQmx/models/get_capabilities.py +++ b/labscript_devices/NI_DAQmx/models/get_capabilities.py @@ -298,7 +298,14 @@ def AI_start_delay(device_name): def AI_filter_delay(device_name): """Determine the filter delay for dynamic signal acquistion devices. - Returns the delay in clock cycles. Absolute delay will vary with sample rate.""" + Returns the delay in clock cycles. Absolute delay will vary with sample rate. + + Args: + device_name (str): NI-MAX device name + + Returns: + int: Number of analog input delays ticks between task start and acquisition start. + """ if 'PFI0' not in DAQmxGetDevTerminals(device_name): return None task = Task() @@ -333,6 +340,13 @@ def supported_AI_terminal_configurations(device_name): """Determine which analong input configurations are supported for each AI. Valid options are RSE, NRSE, Diff, and PseudoDiff. + + Args: + device_name (str): NI-MAX device name + + Returns: + dict: Dictionary of analog input channels where each value is a list of + the supported input terminations. """ supp_types = {} poss_types = {'RSE': c.DAQmx_Val_Bit_TermCfg_RSE, @@ -352,8 +366,7 @@ def supported_AI_ranges_for_non_differential_input(device_name, AI_ranges): """Empirically determine the analog input voltage ranges for non-differential inputs. Tries AI ranges to see which are actually allowed for non-differential input, since - the largest range may only be available for differential input, which we don't - attempt to support (though we could with a little effort). + the largest range may only be available for differential input. Args: device_name (str): NI-MAX device name From 4ea4dc2a73b464548ff06ee01c6f273cc5d1e714 Mon Sep 17 00:00:00 2001 From: David Meyer Date: Mon, 29 Nov 2021 17:45:29 -0500 Subject: [PATCH 19/19] Fixing docstring formatting. --- labscript_devices/NI_DAQmx/models/get_capabilities.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/labscript_devices/NI_DAQmx/models/get_capabilities.py b/labscript_devices/NI_DAQmx/models/get_capabilities.py index a1672501..51fbe910 100644 --- a/labscript_devices/NI_DAQmx/models/get_capabilities.py +++ b/labscript_devices/NI_DAQmx/models/get_capabilities.py @@ -345,7 +345,8 @@ def supported_AI_terminal_configurations(device_name): device_name (str): NI-MAX device name Returns: - dict: Dictionary of analog input channels where each value is a list of + dict: + Dictionary of analog input channels where each value is a list of the supported input terminations. """ supp_types = {}