danielhrisca / asammdf

Fast Python reader and editor for ASAM MDF / MF4 (Measurement Data Format) files
GNU Lesser General Public License v3.0
648 stars 226 forks source link

Unable to read MF4 file conatining Ethernet data #671

Closed Preranayn closed 1 year ago

Preranayn commented 2 years ago

Python version

'python=3.7.5 (default, Dec 9 2021, 17:04:37) \n[GCC 8.4.0]' 'os=Linux-5.4.0-1067-azure-x86_64-with-Ubuntu-18.04-bionic' 'numpy=1.21.5' ldf is not supported xls is not supported xlsx is not supported yaml is not supported 'asammdf=7.0.7'

import platform
import sys
from pprint import pprint

pprint("python=" + sys.version)
pprint("os=" + platform.platform())

try:
    import numpy
    pprint("numpy=" + numpy.__version__)
except ImportError:
    pass

try:
    import asammdf
    pprint("asammdf=" + asammdf.__version__)
except ImportError:
    pass

Code

MDF version

4.10

Code snippet

from asammdf import MDF mdf = MDF("sample.MF4")

Traceback

/local_disk0/pythonVirtualEnvDirs/virtualEnv-8364da14-0cf2-44b6-9105-ef89d7b4f7e6/lib/python3.7/site-packages/asammdf/mdf.py in init(self, name, version, channels, kwargs) 302 self._mdf = MDF3(name, channels=channels, kwargs) 303 elif version in MDF4_VERSIONS: --> 304 self._mdf = MDF4(name, channels=channels, kwargs) 305 elif version in MDF2_VERSIONS: 306 self._mdf = MDF2(name, channels=channels, kwargs)

/local_disk0/pythonVirtualEnvDirs/virtualEnv-8364da14-0cf2-44b6-9105-ef89d7b4f7e6/lib/python3.7/site-packages/asammdf/blocks/mdf_v4.py in init(self, name, version, channels, **kwargs) 385 ) 386 self._from_filelike = False --> 387 self._read(mapped=True) 388 389 # self._file.close()

/local_disk0/pythonVirtualEnvDirs/virtualEnv-8364da14-0cf2-44b6-9105-ef89d7b4f7e6/lib/python3.7/site-packages/asammdf/blocks/mdf_v4.py in _read(self, mapped) 594 # starting from the first channel 595 self._read_channels( --> 596 ch_addr, grp, stream, dg_cntr, ch_cntr, mapped=mapped 597 ) 598

/local_disk0/pythonVirtualEnvDirs/virtualEnv-8364da14-0cf2-44b6-9105-ef89d7b4f7e6/lib/python3.7/site-packages/asammdf/blocks/mdf_v4.py in _read_channels(self, ch_addr, grp, stream, dg_cntr, ch_cntr, channel_composition, mapped) 1060 address=ca_block.composition_addr, 1061 stream=stream, -> 1062 mapped=mapped, 1063 ) 1064 ca_list.append(ca_block)

/local_disk0/pythonVirtualEnvDirs/virtualEnv-8364da14-0cf2-44b6-9105-ef89d7b4f7e6/lib/python3.7/site-packages/asammdf/blocks/v4_blocks.py in init(self, **kwargs) 1457 ) 1458 logger.exception(message) -> 1459 raise MdfException(message) 1460 1461 nr = self.links_nr

MdfException: Expected "##CA" block @0x1fb4a0 but found "b'##CN'"

Description

Unable to read the MF4 file into mdf object itself. The file contains the Ethernet data generated from vector tool CANape.

danielhrisca commented 2 years ago

Did you try Vector MDFValidator? I suspect that there is a problem with your file

Preranayn commented 2 years ago

Did you try Vector MDFValidator? I suspect that there is a problem with your file

Yes , we were able to open the file and read in MDFValidator , but only found warnings as below. MicrosoftTeams-image (5)

danielhrisca commented 2 years ago

Can you send the file for analysis? You can first scramble it to anonymize the information

danielhrisca commented 2 years ago

@Preranayn try with ve2rsion 7.1.0