Skip to content

Commit

Permalink
made mdfconverter executable from pypi package
Browse files Browse the repository at this point in the history
corrected bug with bitarray signal, replaced append of byte into extend of bytes
  • Loading branch information
ratal committed May 27, 2015
1 parent bb72f48 commit 074f91e
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 18 deletions.
11 changes: 11 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#documentation
recursive-include docs/build/html *
recursive-include docs/build/latex/mdfreader.pdf

#example files
#include test/mdf3/*
#include test/MDF4/*

#Misc
#include CHANGES
include LICENSE
3 changes: 3 additions & 0 deletions mdfconverter/mdfconverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
from multiprocessing import freeze_support

if __name__ == "__main__":
main()

def main()
freeze_support()
app = QtGui.QApplication(argv)
myapp = MainWindow()
Expand Down
2 changes: 1 addition & 1 deletion mdfreader/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# along with this program. If not, see http://www.gnu.org/licenses.
#
# ----------------------------------------------------------------------
__version__ = "0.1.4"
__version__ = "0.1.5"
32 changes: 21 additions & 11 deletions mdfreader/mdf4reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,16 +579,15 @@ def __init__(self, info, dataGroup, channelGroup, channelNumber, recordIDsize):

def __str__(self):
output = str(self.channelNumber) + ' '
output += self.name + ' '
output += str(self.signalDataType) + ' '
output += str(self.channelType) + ' '
output += str(self.RecordFormat) + ' '
output += str(self.bitOffset) + ' '
output += str(self.byteOffset) + ' '
output += str(self.posByteBeg) + ' '
output += str(self.posByteEnd) + ' '
output += str(self.posBitBeg) + ' '
output += str(self.posBitEnd)
output += str(self.Format) + ' '
output += 'ChannelType ' + str(self.channelType) + ' '
output += 'DataType ' + str(self.signalDataType) + ' '
output += 'bitOffset ' + str(self.bitOffset) + ' '
output += 'ByteBeg ' + str(self.posByteBeg) + ' '
output += 'ByteEnd ' + str(self.posByteEnd) + ' '
output += 'BitBeg ' + str(self.posBitBeg) + ' '
output += 'BitEnd ' + str(self.posBitEnd)
return output


Expand Down Expand Up @@ -686,6 +685,16 @@ def validity_channel(self, channelName):
"""
return bitwise_and(right_shift(self.invalid_bytes, self.invalid_bit[channelName]), 1)

def __str__(self):
output = str(self.RecordFormat) + ' '
output += str(self.Format) + ' '
output += 'DataType ' + str(self.signalDataType) + ' '
output += 'bitOffset ' + str(self.bitOffset) + ' '
output += 'ByteBeg ' + str(self.posByteBeg) + ' '
output += 'ByteEnd ' + str(self.posByteEnd) + ' '
output += 'BitBeg ' + str(self.posBitBeg) + ' '
output += 'BitEnd ' + str(self.posBitEnd)
return output

class record(list):

Expand Down Expand Up @@ -991,9 +1000,10 @@ def readBitarray(self, bita, channelList=None):
nbytes = len(temp[0].tobytes())
if not nbytes == self[chan].nBytes and \
self[chan].signalDataType not in (6, 7, 8, 9, 10, 11, 12): # not Ctype byte length
byte = 8 * (self[chan].nBytes - nbytes) * bitarray([False])
byte = bitarray(8 * (self[chan].nBytes - nbytes))
byte.setall(False)
for i in range(self.numberOfRecords): # extend data of bytes to match numpy requirement
temp[i].append(byte)
temp[i].extend(byte)
if 's' not in self[chan].Format:
temp = [self[chan].CFormat.unpack(temp[i].tobytes())[0] \
for i in range(self.numberOfRecords)]
Expand Down
12 changes: 6 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# https://packaging.python.org/en/latest/development.html#single-sourcing-the-version
version='0.1.4',
version='0.1.5',

description='A Measured Data Format file parser',
long_description=long_description,
Expand Down Expand Up @@ -92,9 +92,9 @@
# To provide executable scripts, use entry points in preference to the
# "scripts" keyword. Entry points provide cross-platform support and allow
# pip to create the appropriate form of executable for the target platform.
# entry_points={
# 'console_scripts': [
# 'sample=sample:main',
# ],
#},
entry_points={
'console_scripts': [
'mdfconverter=mdfconverter:main',
],
},
)

0 comments on commit 074f91e

Please sign in to comment.