Skip to content

Commit

Permalink
Faster qdac (#53) (#730)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jenshnielsen authored and WilliamHPNielsen committed Sep 13, 2017
1 parent 1d29b19 commit 41ce6d8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
17 changes: 13 additions & 4 deletions qcodes/instrument_drivers/QDev/QDac.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down
11 changes: 10 additions & 1 deletion qcodes/instrument_drivers/QDev/QDac_channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down
3 changes: 2 additions & 1 deletion qcodes/instrument_drivers/stanford_research/SR830.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ def get(self):
# parse it
realdata = np.fromstring(rawdata, dtype='<i2')
numbers = realdata[::2]*2.0**(realdata[1::2]-124)

if self.shape[0] != N:
raise RuntimeError("SR830 got {} points in buffer expected {}".format(N, self.shape[0]))
return numbers


Expand Down

0 comments on commit 41ce6d8

Please sign in to comment.