Skip to content

Commit

Permalink
fix: bug in slicing and adding code
Browse files Browse the repository at this point in the history
Fix bug in slicing/adding code, not correctly passing along
channel list name.
  • Loading branch information
spauka committed Apr 11, 2017
1 parent 5827028 commit 76af2a3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions qcodes/instrument/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def __init__(self, parent, name, chan_type, chan_list=None):
self._parent = parent
self._name = name
if type(chan_type) != type or not issubclass(chan_type, InstrumentChannel):
print(chan_type, InstrumentChannel)
raise ValueError("Channel Lists can only hold instances of type InstrumentChannel")
self._chan_type = chan_type

Expand All @@ -131,7 +132,7 @@ def __getitem__(self, i):
i (int/slice): Either a single channel index or a slice of channels to get
"""
if isinstance(i, slice):
return ChannelList(self._parent, self._chan_type, self._channels[i])
return ChannelList(self._parent, self._name, self._chan_type, self._channels[i])
return self._channels[i]

def __iter__(self):
Expand Down Expand Up @@ -162,7 +163,7 @@ def __add__(self, other):
if self._parent != other._parent:
raise ValueError("Can only add channels from the same parent together.")

return ChannelList(self._parent, self._chan_type, self._channels + other._channels)
return ChannelList(self._parent, self._name, self._chan_type, self._channels + other._channels)

def append(self, object):
"""
Expand Down

0 comments on commit 76af2a3

Please sign in to comment.