From 7ddd6b9b3c5d3aec08e81ce674ff51be222b9f40 Mon Sep 17 00:00:00 2001 From: elrama- Date: Thu, 23 Mar 2017 14:21:04 +0100 Subject: [PATCH 1/2] Chanes to close #537 Adds clock_source and ref_source parameters Also added a change to the get parser of the lowpass filter setting. The value 9.9e37 corresponds to infinity but can give problems when sending it over a port (such as to pyqtgraph). --- .../instrument_drivers/tektronix/AWG5014.py | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/qcodes/instrument_drivers/tektronix/AWG5014.py b/qcodes/instrument_drivers/tektronix/AWG5014.py index 0c599d048d2..c2a9cd9593c 100644 --- a/qcodes/instrument_drivers/tektronix/AWG5014.py +++ b/qcodes/instrument_drivers/tektronix/AWG5014.py @@ -157,12 +157,20 @@ def __init__(self, name, address, timeout=180, **kwargs): vals=vals.Enum('CONT', 'TRIG', 'SEQ', 'GAT'), get_parser=self.newlinestripper ) - self.add_parameter('ref_clock_source', - label='Reference clock source', + self.add_parameter('clock_source', + label='Clock source', get_cmd='AWGControl:CLOCk:SOURce?', set_cmd='AWGControl:CLOCk:SOURce ' + '{}', vals=vals.Enum('INT', 'EXT'), get_parser=self.newlinestripper) + + self.add_parameter('ref_source', + label='Reference source', + get_cmd='SOURce1:ROSCillator:SOURce?', + set_cmd='SOURce1:ROSCillator:SOURce ' + '{}', + vals=vals.Enum('INT', 'EXT'), + get_parser=self.newlinestripper) + self.add_parameter('DC_output', label='DC Output (ON/OFF)', get_cmd='AWGControl:DC:STATe?', @@ -332,7 +340,7 @@ def __init__(self, name, address, timeout=180, **kwargs): set_cmd=filter_cmd + ' {}', vals=vals.Enum(20e6, 100e6, 9.9e37, 'INF', 'INFinity'), - get_parser=float) + get_parser=self._lowpass_filter_get_parser) self.add_parameter('ch{}_DC_out'.format(i), label='DC output level channel {}'.format(i), unit='V', @@ -387,6 +395,13 @@ def newlinestripper(self, string): else: return string + def _lowpass_filter_get_parser(self, string): + if 'E+037\n' in string: + val = 'INF' + else: + val = float(string) + return val + # Functions def get_all(self, update=True): """ From 2cded755e4e94347461ae38b6a50e599f92d7f56 Mon Sep 17 00:00:00 2001 From: elrama- Date: Fri, 24 Mar 2017 10:37:21 +0100 Subject: [PATCH 2/2] Made a more robust out of range get parser --- qcodes/instrument_drivers/tektronix/AWG5014.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/qcodes/instrument_drivers/tektronix/AWG5014.py b/qcodes/instrument_drivers/tektronix/AWG5014.py index c2a9cd9593c..147343dd596 100644 --- a/qcodes/instrument_drivers/tektronix/AWG5014.py +++ b/qcodes/instrument_drivers/tektronix/AWG5014.py @@ -339,8 +339,9 @@ def __init__(self, name, address, timeout=180, **kwargs): get_cmd=filter_cmd + '?', set_cmd=filter_cmd + ' {}', vals=vals.Enum(20e6, 100e6, 9.9e37, + np.float('inf'), 'INF', 'INFinity'), - get_parser=self._lowpass_filter_get_parser) + get_parser=self._tek_outofrange_get_parser) self.add_parameter('ch{}_DC_out'.format(i), label='DC output level channel {}'.format(i), unit='V', @@ -395,11 +396,12 @@ def newlinestripper(self, string): else: return string - def _lowpass_filter_get_parser(self, string): - if 'E+037\n' in string: - val = 'INF' - else: - val = float(string) + def _tek_outofrange_get_parser(self, string): + val = float(string) + # note that 9.9e37 is used as a generic out of range value + # in tektronix instruments + if val >= 9.9e37: + val = np.float('INF') return val # Functions