ratal / mdfreader

Read Measurement Data Format (MDF) versions 3.x and 4.x file formats in python
Other
169 stars 74 forks source link

Cannot instantiate #115

Closed found36 closed 6 years ago

found36 commented 6 years ago

I can't instantiate a module. *code ****

-- coding: utf-8 --

import mdfreader NameofFile = r'C:\Users\Administrator\Desktop\S5_CVT_emission_0801\S5_CVT_emission_0801.dat' yop = mdfreader.mdf(NameofFile)


C:\Python27\python.exe C:/Users/Administrator/PycharmProjects/Charger_BMS_TEST/TestPrint.py Traceback (most recent call last): File "C:/Users/Administrator/PycharmProjects/Charger_BMS_TEST/TestPrint.py", line 4, in yop = mdfreader.mdf(NameofFile) File "C:\Python27\lib\site-packages\mdfreader\mdf.py", line 146, in init compression=compression) File "C:\Python27\lib\site-packages\mdfreader\mdfreader.py", line 398, in read convertAfterRead, filterChannelNames, compression) File "C:\Python27\lib\site-packages\mdfreader\mdf3reader.py", line 889, in read3 buf.read(channelSet) # reads datablock potentially containing several channel groups File "C:\Python27\lib\site-packages\mdfreader\mdf3reader.py", line 686, in read nameList=channelSet) File "C:\Python27\lib\site-packages\mdfreader\mdf3reader.py", line 712, in loadSorted return record.readSortedRecord(self.fid, self.pointerToData, nameList) File "C:\Python27\lib\site-packages\mdfreader\mdf3reader.py", line 470, in readSortedRecord buf = recarray(self.numberOfRecords, channel_format) # initialise array File "C:\Python27\lib\site-packages\numpy\core\records.py", line 414, in new descr = sb.dtype(dtype) TypeError: data type not understood

found36 commented 6 years ago

untitled

ratal commented 6 years ago

Hi, Can you mention which version you are using ? To start troubleshooting, can you print channel_format before the call of recarray initialisation ?

found36 commented 6 years ago

Thanks for your reply. image

found36 commented 6 years ago

image

ratal commented 6 years ago

ok, 2.7.1 It was not clear from me, can you insert 'print(channel_format)' before the line 470 in mdf3reader.py and report here the output ? Reason: a numpy dtype seems not correct, so let's have a look at it, maybe a strange channel name.

found36 commented 6 years ago

it is ok when I reinstall mdfreader 0.2.7 thank you very much.

ratal commented 6 years ago

It means there is potentially regression between 0.2.7 to 2.7.1 ... If you have time to investigate, can I kindly ask you to send this print, otherwise close the issue ?

found36 commented 6 years ago

image

[(('time_title', u'time'), '<f8'), (('ABS_RRWheelSpeed_title', u'ABS_RRWheelSpeed'), '<u2'), (('ABS_RLWheelSpeed_title', u'ABS_RLWheelSpeed'), '<u2'), (('ABS_FRWheelSpeed_title', u'ABS_FRWheelSpeed'), '<u2'), (('ABS_FLWheelSpeed_title', u'ABS_FLWheelSpeed'), '<u2')]

ratal commented 6 years ago

I coudl notice a regression with python 2.7 and these channel naming issue. I am working on a fix.

ratal commented 6 years ago

I made a fix in last commit only for mdf3 for the moment, you can try it.

found36 commented 6 years ago

Thanks

ratal commented 6 years ago

If it works for you, please close the issue