ratal / mdfreader

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

Key Error in "mdf3reader.py", line 880 (v2.6) #93

Closed rolfub closed 6 years ago

rolfub commented 6 years ago

Hello Aymeric,

I have a problem with the new release 2.6. There is a key error exception in line 880: "buf[channelName].append(temp[channelName]) # to remove append" (mdf3reader.py). I don't no why. I have temporary fixed it with: "if ( channelName in buf ): ". But I don't no if this is the right solution. Can you please take a quick look at it. If you need further information please write me.

Rolf

danielhrisca commented 6 years ago

Hey, Rolf Can you provide the MDF file?

rolfub commented 6 years ago

Hallo Daniel, sorry I must not provide the file. But I can debug for you. :-) Rolf

danielhrisca commented 6 years ago

Too bad, looks like you have a not so common file. Would have been interesting to try it against my MDF lib

rolfub commented 6 years ago

Hello Daniel, you only have to make a CANoe Trace and save it in MDF3.3. Rolf

ratal commented 6 years ago

Hi Rolfub, This part is for usorted data, CANoe is by default writing unsorted ? I have a file from CANoe unsorted I retested with latest master and I do not find any issue with it, there should be something else. I guess this is channel renaming issue, you are not the only one to have this problem in 2.6. Maybe you can print what channelName the code is expecting and compare with original name ?

ratal commented 6 years ago

Hi Rolfub, Embedded channels were not initialised in buf dictionnary. I introduced defaultdict(list) in last commit, you can try.

rolfub commented 6 years ago

Hello Aymeric, I have tried your last commit and it works. :-) Thank you! And yes, it seems that CANoe uses unsorted by default. Rolf

ratal commented 6 years ago

No problem ! unsorted data are relativelly uncommon, not so mainy files to test against and not so optimised, especially for mdf4. So do not hesitate if you have files to share to contribute to the community (Also for Daniel).

danielhrisca commented 6 years ago

I can imagine that for low latency reason a logger app could use unsorted records. It is my experience as well that unsorted files are not common.

ratal commented 6 years ago

I recorded data mostly from Inca, other proprietary systems and dataloggers like intrepid, and those are not using unsorted data for both version 3 and 4. Most probably Vector's child. But I agree, for datalogger it makes sense as you can write your data while you are getting it. Other cans do it sorted, maybe at the cost of more buffer memory and slight record bandwidth restriction but at the cost of slower reading for the user I think. Matter of choice.