Skip to content

Commit

Permalink
changed VersionNumber to more explicit MDFVersionNumber
Browse files Browse the repository at this point in the history
  • Loading branch information
ratal committed Sep 21, 2015
1 parent 01a4f7b commit ab5d9fb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions mdfreader/mdf3reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ class mdf3(dict):
--------------
fileName : str
file name
VersionNumber : int
MDFVersionNumber : int
mdf file version number
masterChannelList : dict
Represents data structure: a key per master channel with corresponding value containing a list of channels
Expand Down Expand Up @@ -594,7 +594,7 @@ def __init__(self, fileName=None, info=None, multiProc=False, channelList=None,
self.comment = ''
self.time = ''
self.date = ''
self.VersionNumber = 300
self.MDFVersionNumber = 300
self.filterChannelNames = False
# clears class from previous reading and avoid to mess up
self.clear()
Expand Down Expand Up @@ -863,7 +863,7 @@ def writeChar(f, value, size=None):
else:
temp = value + '\0' * (size - len(value))
temp += '\0'
if self.VersionNumber < 400:
if self.MDFVersionNumber < 400:
if PythonVersion >= 3:
temp = temp.encode('latin1', 'replace')
f.write(pack('<' + str(len(temp)) + 's', temp))
Expand Down
4 changes: 2 additions & 2 deletions mdfreader/mdf4reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,7 @@ class mdf4(dict):
--------------
fileName : str
file name
VersionNumber : int
MDFVersionNumber : int
mdf file version number
masterChannelList : dict
Represents data structure: a key per master channel with corresponding value containing a list of channels
Expand Down Expand Up @@ -1121,7 +1121,7 @@ def __init__(self, fileName=None, info=None, multiProc=False, channelList=None,
self.masterChannelList = {}
self.multiProc = False # flag to control multiprocessing, default deactivate, giving priority to mdfconverter
self.convert_tables = False # if True converts raw data with expensive loops, not necessary most cases
self.VersionNumber = 400
self.MDFVersionNumber = 400
self.author = ''
self.organisation = ''
self.project = ''
Expand Down
20 changes: 10 additions & 10 deletions mdfreader/mdfreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ def readinfo(self, fileName=None, filterChannelNames=False):
raise Exception('Can not find file ' + self.fileName)
# read Identifier block
fid.seek(28)
VersionNumber = unpack('<H', fid.read(2))
self.mdfversion = VersionNumber[0]
MDFVersionNumber = unpack('<H', fid.read(2))
self.mdfversion = MDFVersionNumber[0]
if self.mdfversion < 400: # up to version 3.x not compatible with version 4.x
from .mdfinfo3 import info3
self.update(info3(None, fid, filterChannelNames))
Expand Down Expand Up @@ -177,8 +177,8 @@ def listChannels(self, fileName=None):
raise Exception('Can not find file ' + self.fileName)
# read Identifier block
fid.seek(28)
VersionNumber = unpack('<H', fid.read(2))
self.mdfversion = VersionNumber[0]
MDFVersionNumber = unpack('<H', fid.read(2))
self.mdfversion = MDFVersionNumber[0]
if self.mdfversion < 400: # up to version 3.x not compatible with version 4.x
from .mdfinfo3 import info3
channelNameList = info3()
Expand All @@ -198,7 +198,7 @@ class mdf(mdf3, mdf4):
--------------
fileName : str
file name
VersionNumber : int
MDFVersionNumber : int
mdf file version number
masterChannelList : dict
Represents data structure: a key per master channel with corresponding value containing a list of channels
Expand Down Expand Up @@ -305,7 +305,7 @@ def __init__(self, fileName=None, channelList=None, convertAfterRead=True, filte
flag to filter long channel names from its module names separated by '.'
"""
self.fileName = None
self.VersionNumber = None
self.MDFVersionNumber = None
self.masterChannelList = {}
self.author = ''
self.organisation = ''
Expand Down Expand Up @@ -364,8 +364,8 @@ def read(self, fileName=None, multiProc=False, channelList=None, convertAfterRea
# read file blocks
info = mdfinfo(self.fileName, filterChannelNames)

self.VersionNumber = info.mdfversion
if self.VersionNumber < 400: # up to version 3.x not compatible with version 4.x
self.MDFVersionNumber = info.mdfversion
if self.MDFVersionNumber < 400: # up to version 3.x not compatible with version 4.x
self.read3(self.fileName, info, multiProc, channelList, convertAfterRead)
else: # MDF version 4.x. Channel by channel reading implemented
self.read4(self.fileName, info, multiProc, channelList, convertAfterRead)
Expand Down Expand Up @@ -409,7 +409,7 @@ def getChannelData(self, channelName):
------
This method is the safest to get channel data as numpy array from 'data' dict key might contain raw data
"""
if self.VersionNumber < 400:
if self.MDFVersionNumber < 400:
return self._getChannelData3(channelName)
else:
return self._getChannelData4(channelName)
Expand All @@ -418,7 +418,7 @@ def convertAllChannel(self):
"""Converts all channels from raw data to converted data according to CCBlock information
Converted data will take more memory.
"""
if self.VersionNumber < 400:
if self.MDFVersionNumber < 400:
return self._convertAllChannel3()
else:
return self._convertAllChannel4()
Expand Down

0 comments on commit ab5d9fb

Please sign in to comment.