From 41ce6d8ed67f0e037e73c2a6416c9c8e8a16d187 Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Wed, 13 Sep 2017 14:33:01 +0200 Subject: [PATCH] Faster qdac (#53) (#730) * Faster qdac (#53) * add support for faster setting of qdac voltage * SR830 fail early in buffered readout if butffer is not full as expected * add option to qdac to ignore return read on voltage set This ivery experimental and likely to break if you are not careful * Remove option to not readback in voltage set. This has too many potential issues and may result in crashes * Add fast voltage set to channel qdac driver too * fix stupid error --- qcodes/instrument_drivers/QDev/QDac.py | 17 +++++++++++++---- qcodes/instrument_drivers/QDev/QDac_channels.py | 11 ++++++++++- .../stanford_research/SR830.py | 3 ++- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/qcodes/instrument_drivers/QDev/QDac.py b/qcodes/instrument_drivers/QDev/QDac.py index f7d1221f247..de07e143f20 100644 --- a/qcodes/instrument_drivers/QDev/QDac.py +++ b/qcodes/instrument_drivers/QDev/QDac.py @@ -156,6 +156,14 @@ def __init__(self, name, address, num_chans=48, update_currents=True): set_cmd='ver {}', val_mapping={True: 1, False: 0}) + self.add_parameter(name='fast_voltage_set', + label='fast voltage set', + parameter_class=ManualParameter, + vals=vals.Bool(), + initial_value=False, + docstring=""""Toggles if DC voltage set should unset any ramp attached to this channel. + If you enable this you should ensure thay any function generator is unset + from the channel before setting voltage""") # Initialise the instrument, all channels DC (unbind func. generators) for chan in self.chan_range: # Note: this call does NOT change the voltage on the channel @@ -208,17 +216,18 @@ def _set_voltage(self, chan, v_set): self._assigned_fgs[chan] = fg # We need .get and not get_latest in case a ramp was interrupted v_start = self.parameters['ch{:02}_v'.format(chan)].get() - time = abs(v_set-v_start)/slope - log.info('Slope: {}, time: {}'.format(slope, time)) + mytime = abs(v_set-v_start)/slope + log.info('Slope: {}, time: {}'.format(slope, mytime)) # Attenuation compensation and syncing # happen inside _rampvoltage - self._rampvoltage(chan, fg, v_start, v_set, time) + self._rampvoltage(chan, fg, v_start, v_set, mytime) else: # compensate for the 0.1 multiplier, if it's on if self.parameters['ch{:02}_vrange'.format(chan)].get_latest() == 1: v_set = v_set*10 # set the mode back to DC in case it had been changed - self.write('wav {} 0 0 0'.format(chan)) + if not self.fast_voltage_set(): + self.write('wav {} 0 0 0'.format(chan)) self.write('set {} {:.6f}'.format(chan, v_set)) def _set_vrange(self, chan, switchint): diff --git a/qcodes/instrument_drivers/QDev/QDac_channels.py b/qcodes/instrument_drivers/QDev/QDac_channels.py index 6ba3ca3ed14..acaf1d545fa 100644 --- a/qcodes/instrument_drivers/QDev/QDac_channels.py +++ b/qcodes/instrument_drivers/QDev/QDac_channels.py @@ -244,6 +244,14 @@ def __init__(self, name, address, num_chans=48, update_currents=True): set_cmd='ver {}', val_mapping={True: 1, False: 0}) + self.add_parameter(name='fast_voltage_set', + label='fast voltage set', + parameter_class=ManualParameter, + vals=vals.Bool(), + initial_value=False, + docstring=""""Toggles if DC voltage set should unset any ramp attached to this channel. + If you enable this you should ensure that any function generator is unset + from the channel before setting voltage""") # Initialise the instrument, all channels DC (unbind func. generators) for chan in self.chan_range: # Note: this call does NOT change the voltage on the channel @@ -314,7 +322,8 @@ def _set_voltage(self, chan, v_set): if self.channels[chan-1].vrange.get_latest() == 1: v_set = v_set*10 # set the mode back to DC in case it had been changed - self.write('wav {} 0 0 0'.format(chan)) + if not self.fast_voltage_set(): + self.write('wav {} 0 0 0'.format(chan)) self.write('set {} {:.6f}'.format(chan, v_set)) def _set_vrange(self, chan, switchint): diff --git a/qcodes/instrument_drivers/stanford_research/SR830.py b/qcodes/instrument_drivers/stanford_research/SR830.py index b7d315cd3c8..1b0827f6231 100644 --- a/qcodes/instrument_drivers/stanford_research/SR830.py +++ b/qcodes/instrument_drivers/stanford_research/SR830.py @@ -108,7 +108,8 @@ def get(self): # parse it realdata = np.fromstring(rawdata, dtype='