Commit 67c0a912 authored by Javier Quinteros's avatar Javier Quinteros
Browse files

Skip file and continue processing if a critical error is found

parent 1a8900d8
__version__ = '0.7a2'
__version__ = '0.7a3'
......@@ -381,6 +381,7 @@ class TDMS(object):
if self.__segmentOffset == self.__FF64b:
logs.error('Severe problem while writing data (crash, power outage)')
raise Exception('Corrupted file due to crash or power outage')
if hasmetadata and not self.__dataOffset:
logs.error('Flag indicates Metadata but its length is 0!')
......@@ -410,7 +411,14 @@ class TDMS(object):
while True:
# Loop through files until there is nothing else (IndexError)
self.__select_file()
try:
self.__select_file()
except IndexError:
raise
except Exception as e:
logging.warning('Skipping file because of %s' % str(e))
self.__currentfile += 1
continue
# Read the metadata and calculate samples to read
# Skip to the next file if there is a gap
......@@ -469,6 +477,7 @@ class TDMS(object):
try:
if self.sampling_rate is None:
self.sampling_rate = self.metadata[obj]['SamplingFrequency[Hz]']
# TODO Check for decimation, not for filter length
if len(self.__filter):
tap = (len(self.__filter) - 1) / (2.0 * self.sampling_rate)
# If there is decimation adjust the start and end times to include the tapering
......
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