Commit 80405881 authored by Javier Quinteros's avatar Javier Quinteros
Browse files

Bugfix: Flag to recognize the start of a continuous chunk was not separated per channel

See issue #24
parent 5cdd13a3
......@@ -631,7 +631,8 @@ class TDMS(object):
# Time of the first sample in the next file
expectedtime = dict()
# Flag to know if we are at the beginning of the chunk
startofchunk = True
# There should be one entry per channel with a default value of True
startofchunk = dict()
for data, stats in self.__iter_data__():
ch = int(stats['station'])
......@@ -661,7 +662,7 @@ class TDMS(object):
# self.__buffer[ch] = None
del expectedtime[ch]
# Start the processing of a new chunk after the gap
startofchunk = True
startofchunk[ch] = True
expectedtime[ch] = stats['starttime'] + stats['npts']/self.sampling_rate
......@@ -680,9 +681,9 @@ class TDMS(object):
outbuf[ch] = {'stats': inbuf[ch]['stats'].copy()}
# Modify the starting time only if it is the beginning of the signal
if startofchunk:
if (ch not in startofchunk) or startofchunk[ch]:
outbuf[ch]['stats']['starttime'] += (len(self.__filter)-1)/(2 * outbuf[ch]['stats']['sampling_rate'])
startofchunk = False
startofchunk[ch] = False
# Change the headers to reflect the decimation
# Reduce the sampling rate by the decimation factor
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