Skip to content

Commit

Permalink
Making Decadac Extensible (#876)
Browse files Browse the repository at this point in the history
* added type of decadac-channel as class variable

* treat default slot mode similarly as DAC_CHANNEL_CLASS

* using the class variable everywhere + DAC_SLOT_CLASS
  • Loading branch information
Dominik-Vogel authored Nov 21, 2017
1 parent 7f47183 commit b996798
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions qcodes/instrument_drivers/Harvard/Decadac.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,9 @@ def __init__(self, parent, name, slot, min_val=-5, max_val=5):
self._VERSA_EEPROM_available = self._parent._VERSA_EEPROM_available

# Create a list of channels in the slot
channels = ChannelList(self, "Slot_Channels", DacChannel)
channels = ChannelList(self, "Slot_Channels", parent.DAC_CHANNEL_CLASS)
for i in range(4):
channels.append(DacChannel(self, "Chan{}".format(i), i,
channels.append(parent.DAC_CHANNEL_CLASS(self, "Chan{}".format(i), i,
min_val=min_val, max_val=max_val))
self.add_submodule("channels", channels)
# Set the slot mode. Valid modes are:
Expand All @@ -328,7 +328,7 @@ def __init__(self, parent, name, slot, min_val=-5, max_val=5):
val_mapping=slot_modes)

# Enable all slots in coarse mode.
self.slot_mode.set(DacSlot.SLOT_MODE_DEFAULT)
self.slot_mode.set(self.SLOT_MODE_DEFAULT)

def write(self, cmd):
"""
Expand Down Expand Up @@ -366,6 +366,8 @@ class Decadac(VisaInstrument, DacReader):
_ramp_time (int): The ramp time in ms. Default 100 ms.
"""
DAC_CHANNEL_CLASS = DacChannel
DAC_SLOT_CLASS = DacSlot

def __init__(self, name, address, min_val=-5, max_val=5, **kwargs):
"""
Expand Down Expand Up @@ -395,10 +397,10 @@ def __init__(self, name, address, min_val=-5, max_val=5, **kwargs):
self._feature_detect()

# Create channels
channels = ChannelList(self, "Channels", DacChannel, snapshotable=False)
slots = ChannelList(self, "Slots", DacSlot)
for i in range(5): # Create the 5 DAC slots
slots.append(DacSlot(self, "Slot{}".format(i), i, min_val, max_val))
channels = ChannelList(self, "Channels", self.DAC_CHANNEL_CLASS, snapshotable=False)
slots = ChannelList(self, "Slots", self.DAC_SLOT_CLASS)
for i in range(5): # Create the 6 DAC slots
slots.append(self.DAC_SLOT_CLASS(self, "Slot{}".format(i), i, min_val, max_val))
channels.extend(slots[i].channels)
slots.lock()
channels.lock()
Expand Down

0 comments on commit b996798

Please sign in to comment.