Commit c2c72425 authored by Javier Quinteros's avatar Javier Quinteros

Many minor changes related to PEP8

parent be237852
......@@ -269,25 +269,21 @@ class TDMS(object):
leadin = self.__fi.read(self.__HEADERLEN)
(tag, ToCmask) = struct.unpack('<4si', leadin[:8])
kTocMetaData = 1 << 1
kTocNewObjList = 1 << 2
kTocRawData = 1 << 3
kTocInterleavedData = 1 << 5
kTocBigEndian = 1 << 6
kTocDAQmxRawData = 1 << 7
# self.hasmetadata = bool(ToCmask & kTocMetaData)
hasmetadata = bool(ToCmask & kTocMetaData)
# self.hasnewObjects = bool(ToCmask & kTocNewObjList)
hasnewObjects = bool(ToCmask & kTocNewObjList)
# self.hasrawData = bool(ToCmask & kTocRawData)
hasrawData = bool(ToCmask & kTocRawData)
self.__hasInterleavedData = bool(ToCmask & kTocInterleavedData)
# self.hasDAQmxRawData = bool(ToCmask & kTocDAQmxRawData)
hasDAQmxRawData = bool(ToCmask & kTocDAQmxRawData)
ktocmetadata = 1 << 1
ktocnewobjlist = 1 << 2
ktocrawdata = 1 << 3
ktocinterleaveddata = 1 << 5
ktocbigendian = 1 << 6
ktocdaqmxrawdata = 1 << 7
hasmetadata = bool(ToCmask & ktocmetadata)
hasnewobjects = bool(ToCmask & ktocnewobjlist)
hasrawdata = bool(ToCmask & ktocrawdata)
self.__hasInterleavedData = bool(ToCmask & ktocinterleaveddata)
hasdaqmxrawdata = bool(ToCmask & ktocdaqmxrawdata)
# All input from now on will be formatted by this
self.__endian = '>' if ToCmask & kTocBigEndian else '<'
self.__endian = '>' if ToCmask & ktocbigendian else '<'
if tag.decode() != 'TDSm':
raise Exception('Tag is not TDSm!')
......@@ -306,7 +302,7 @@ class TDMS(object):
if hasmetadata and not self.__dataOffset:
logs.error('Flag indicates Metadata but its length is 0!')
if hasDAQmxRawData:
if hasdaqmxrawdata:
logs.warning('DAQmx raw data is still not supported!')
# Absolute offsets
......@@ -314,11 +310,11 @@ class TDMS(object):
self.__dataOffset += self.__HEADERLEN
logs.debug('Metadata: ' + ('yes' if hasmetadata else 'no'))
logs.debug('Object list: ' + ('yes' if hasnewObjects else 'no'))
logs.debug('Raw data: ' + ('yes' if hasrawData else 'no'))
logs.debug('Object list: ' + ('yes' if hasnewobjects else 'no'))
logs.debug('Raw data: ' + ('yes' if hasrawdata else 'no'))
logs.debug('Interleaved data: ' + ('yes' if self.__hasInterleavedData else 'no'))
logs.debug('BigEndian: ' + ('yes' if self.__endian == '<' else 'no'))
logs.debug('DAQmx raw data: ' + ('yes' if hasDAQmxRawData else 'no'))
logs.debug('DAQmx raw data: ' + ('yes' if hasdaqmxrawdata else 'no'))
# self.__readmetadata()
......@@ -472,7 +468,7 @@ class TDMS(object):
logs.debug('Length of channel: %d' % channellength)
# New or changed objects
newObjects = struct.unpack('%cI' % self.__endian, self.__fi.read(4))[0]
newobjects = struct.unpack('%cI' % self.__endian, self.__fi.read(4))[0]
def __iter__(self):
"""Iterate through data (or metadata) and filter and decimate if requested"""
......@@ -611,7 +607,6 @@ class TDMS(object):
# Data
logs = logging.getLogger('Iterate Data')
# print(self.__currentfile, self.__twstart, self.starttime, self.__samplestart, self.__samplecur, self.__sampleend)
# Data is stored with values from one channel in a continuous array
if not self.__hasInterleavedData:
# for ch in range(self.__chstart, self.__chstop + 1, self.__chstep):
......
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