ratal / mdfreader

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

Different read errors #15

Closed JonathanTT closed 9 years ago

JonathanTT commented 9 years ago

Hello, I am loving your tool for the awesome speed it provides, however I noticed one or two bugs or something I don't know why it happens. If it's just me please correct me.

Some of the mdf files I'd like to read don't work at all and I get the following error: "ValueError: Not enough bytes left in file for specified shape and type". My guess is, the mdf is not totally correct, however other tools like CANape read it without any problems.

The seccond problem happens with the files that work to read (other file origin). Here some signals are read in prefectly and some aren't. The wrong signals do have weird timestamps in the master channel and also wrong values in the signal channel. However it seems like every 8th (or for some every 16th) value is correct. If a signal is wrong every other signal that uses the same master channel is also not correct.

Here is an example of what I mean (master left, signal right): 0.7816270000000001-----------8709 8.511752513479514E-154-----524288 1.8481E-319-----------------------65288 -8.229186798482021E294-----39680 -1.3107045803846904E-187--0 8.4203E-319-----------------------962816 1.77266332229639E268--------851560 4.85948271492081E121-------344576 9.780756----------------------------8709 8.512006343632276E-154-----524288 1.8481E-319-----------------------65288 -8.229186798482054E294-----39936 -8.589833538009107E-183---0 8.4746E-319-----------------------606784 3.428829535692728E293------999731 -1.9219814427611343E-245--344592 18.779568--------------------------8709 8.512093962532729E-154-----524288 1.8481E-319-----------------------65288 -8.22918679848207E294------40192 -5.629433307469648E-178----0 8.52896E-319---------------------153600 8.121418629503833E-124-----524860 -4.1477461483712573E225---344600 27.778571000000003-----------8709 8.512145166432896E-154-----524288 1.8481E-319-----------------------65288

The Value 8709 is correct, all the others aren't. Also the according times seem to be the only ones to make sense.

Is it possible that at some point within the raw data reading something goes wrong depending on the exact mdf file format? To me it looks like a shift of one bit or so. Another guess is that something about 64bit isn't supported somehow. I am using python 64bit and also compiled Cython for 64bit use.

Thanks in advance! Jonathan

ratal commented 9 years ago

Hi Jonathan, I do not think there is concern related to 64bit. However, there seems definitely to be a bug. The fact that the first record is properly read and the remainings are not means that the record size and structure is not well understood/parsed. This is a bit difficult to help you without more info:

  1. You can check the content of your file using mdf validator freely downloadable from vector website. Then compare it with content of mdfinfo4.
  2. If there is no mismatch, the way the data are read has bug somewhere, becomes more complicated to track... Most straight forward is that you send me faulty files (can be dummy) and I will dig in it. By the way, which version are you using ? Regards Aymeric
ratal commented 9 years ago

No feed back since a while, I guess it is fixed. Jonathan, do not hesitate to re-open the issue.