From ae5fd9fb86f8d80ee5b028fc6339cdae2f78ae29 Mon Sep 17 00:00:00 2001 From: David Meyer Date: Mon, 7 Mar 2022 12:33:03 -0500 Subject: [PATCH] Allow passthrough of other kwargs in DDS gate DigitalOut specification. In particular, this allows for the digital gate to have inverted logic. --- labscript/labscript.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/labscript/labscript.py b/labscript/labscript.py index 1271d8b..ba3b5fd 100644 --- a/labscript/labscript.py +++ b/labscript/labscript.py @@ -2799,7 +2799,7 @@ def __init__(self, name, parent_device, connection, digital_gate={}, freq_limits digital_gate (dict, optional): Configures a digital output to use as an enable/disable gate for the output. Should contain keys `'device'` and `'connection'` with arguments for the `parent_device` and `connection` for instantiating - the :obj:`DigitalOut`. + the :obj:`DigitalOut`. All other (optional) keys are passed as kwargs. freq_limits (tuple, optional): `(lower, upper)` limits for the frequency of the output freq_conv_class (:obj:`labscript_utils:labscript_utils.unitconversions`, optional): @@ -2851,8 +2851,10 @@ def __init__(self, name, parent_device, connection, digital_gate={}, freq_limits self.phase = AnalogQuantity(self.name + '_phase', self, 'phase', phase_limits, phase_conv_class, phase_conv_params) self.gate = None - if 'device' in digital_gate and 'connection' in digital_gate: - self.gate = DigitalOut(name + '_gate', digital_gate['device'], digital_gate['connection']) + if 'device' in digital_gate and 'connection' in digital_gate: + dev = digital_gate.pop('device') + conn = digital_gate.pop('connection') + self.gate = DigitalOut(name + '_gate', dev, conn, **digital_gate) # Did they only put one key in the dictionary, or use the wrong keywords? elif len(digital_gate) > 0: raise LabscriptError('You must specify the "device" and "connection" for the digital gate of %s.' % (self.name)) @@ -2980,7 +2982,7 @@ def __init__(self,name,parent_device,connection,digital_gate = {},freq_limits = digital_gate (dict, optional): Configures a digital output to use as an enable/disable gate for the output. Should contain keys `'device'` and `'connection'` with arguments for the `parent_device` and `connection` for instantiating - the :obj:`DigitalOut`. + the :obj:`DigitalOut`. All other (optional) keys are passed as kwargs. freq_limits (tuple, optional): `(lower, upper)` limits for the frequency of the output freq_conv_class (:obj:`labscript_utils:labscript_utils.unitconversions`, optional): @@ -3030,8 +3032,10 @@ def __init__(self,name,parent_device,connection,digital_gate = {},freq_limits = self.amplitude = StaticAnalogQuantity(self.name+'_amp',self,'amp',amp_limits,amp_conv_class,amp_conv_params) self.phase = StaticAnalogQuantity(self.name+'_phase',self,'phase',phase_limits,phase_conv_class,phase_conv_params) - if 'device' in digital_gate and 'connection' in digital_gate: - self.gate = DigitalOut(self.name+'_gate',digital_gate['device'],digital_gate['connection']) + if 'device' in digital_gate and 'connection' in digital_gate: + dev = digital_gate.pop('device') + conn = digital_gate.pop('connection') + self.gate = DigitalOut(name + '_gate', dev, conn, **digital_gate) # Did they only put one key in the dictionary, or use the wrong keywords? elif len(digital_gate) > 0: raise LabscriptError('You must specify the "device" and "connection" for the digital gate of %s.'%(self.name))