Commit 9673997a authored by Javier Quinteros's avatar Javier Quinteros

All channels to read data from must be included in the original list

parent dcb919d8
......@@ -737,7 +737,7 @@ class TDMS(object):
def __readdatatype(self):
return struct.unpack('%cI' % self.__endian, self.__fi.read(4))[0]
def __readdata(self, channels=[0]):
def __readdata(self, channels=None):
"""Read a chunk of data from the specified channels
:param channels: List of channel numbers to read data from
......@@ -746,6 +746,19 @@ class TDMS(object):
:rtype: dict
"""
logs = logging.getLogger('Read data')
logs.setLevel(self.__loglevel)
# If there is no channel specified read from all selected channels
if channels is None:
channels = self.__channels
else:
for ch in channels:
# All channels must be within the originally selected channels
if ch not in self.__channels:
logs.error('Trying to read data from an unselected channel!')
raise Exception('Trying to read data from an unselected channel!')
result = dict()
numsamples = self.__sampleend - self.__samplestart + 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment