ratal / mdfreader

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

exception during merge #88

Closed danielhrisca closed 6 years ago

danielhrisca commented 6 years ago

Trying to merge 4 test files with the following code:

from asammdf import MDF
from mdfreader import mdf

x = mdf(r'd:\TMP\x.mf4')
for file in [
           r'd:\TMP\x1.mf4',
           r'd:\TMP\x2.mf4',
           r'd:\TMP\x3.mf4']:
    x2 = mdf(file)
    x.mergeMdf(x2)

x.write(r'd:\TMP\merged_mdfreader.mf4')

I get an exception:

Traceback (most recent call last):
  File "D:\WinPython-64bit-3.6.2.0Qt5b3\notebooks\untitled17.py", line 27, in <module>
    x.mergeMdf(x2)
  File "d:\WinPython-64bit-3.6.2.0Qt5b3\python-3.6.2rc1.amd64\lib\site-packages\mdfreader\mdfreader.py", line 1135, in mergeMdf
    raise Exception('Data not resampled')
Exception: Data not resampled
ratal commented 6 years ago

Hi Daniel, This merge method works only for resampled mdf, meaning only one master channel. Otherwise, much more complex to merge, especially if you do not know what raster correspond to what other raster, all groups having same names like 't' for time. So you should do a resample() before merging. There should be a working example in mdfconvert module, mdfreaderui4 or 5.py, on_Convert_clicked()

danielhrisca commented 6 years ago

I expected to work based on the internal structure of the mdf file, without the need to resample.