ratal / mdfreader

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

errors in files written by mdfreader #84

Closed danielhrisca closed 7 years ago

danielhrisca commented 7 years ago

Loading and saving the test files to disk:

from mdfreader import mdf

x = mdf(r'D:\TMP\test.mf4')

x.write(r'D:\TMP\x.mf4')

x = mdf(r'D:\TMP\test.mdf')

x.write(r'D:\TMP\x.mdf')

gives for version 3:

image

and for version 4:

image

ratal commented 7 years ago

Hi Daniel, There was a minor bug in mdf4 write (wrong pointer address). And I refactored mdf 3 write, there should not be any error and performance improved. Still some warnings related to channel name not being conform with ASAP2.

danielhrisca commented 7 years ago

hello Aymeric,

there are still some errors:

mdfreader 0.2.6 mdfv3                                    145      507
Process Process-15:
Traceback (most recent call last):
  File "/usr/lib/python3.6/multiprocessing/process.py", line 249, in _bootstrap
    self.run()
  File "/usr/lib/python3.6/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "/home/daniel/.config/spyder-py3/temp.py", line 213, in save_reader3
    x.write(r'x.mdf')
  File "/usr/lib/python3.6/site-packages/mdfreader/mdfreader.py", line 422, in write
    self.write3(fileName=self.fileName)
  File "/usr/lib/python3.6/site-packages/mdfreader/mdf3reader.py", line 1386, in write3
    fid.write(pack('<2sH5IH32s128s4H3d2IH', *head))
struct.error: argument for 's' must be a bytes object
ratal commented 7 years ago

just fixed it, I did first tests with python2, forgot python3

danielhrisca commented 7 years ago

I still get the error.

ratal commented 7 years ago

Are you on commit 36dfe4a ?

danielhrisca commented 7 years ago

Yes, I've installed the latest commit after your previous comment

ratal commented 7 years ago

fid.write(pack('<2sH5IH32s128s4H3d2IH', *head)) is for me line 1391 ?

danielhrisca commented 7 years ago

Forgot to add -U parameter to pip

For version 3 now it complains about strings not being correctly terminated

image

ratal commented 7 years ago

Just fixed it in last commit. ASAP2 names remain non conform as in original file.

danielhrisca commented 7 years ago

fixed