danielhrisca / asammdf

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

Unexpected output on console (neither error nor warning) while reading MF4 file. #69

Closed gdu2003 closed 6 years ago

gdu2003 commented 6 years ago

Python version

Please run the following snippet and write the output here

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

('python=3.5.4 (v3.5.4:3f56838, Aug 8 2017, 02:17:05) [MSC v.1900 64 bit ' '(AMD64)]') 'os=Windows-7-6.1.7601-SP1' 'numpy=1.14.3' 'asammdf=3.5.0'

Code

MDF version

_please write here the file version (you can run print(MDF(file).version))

print(MDF4(mdf_file).version) Expected CG, SD, DL, DZ or CN block at 0x602b008 but found id="b'##AT'" Expected CG, SD, DL, DZ or CN block at 0x602b068 but found id="b'##AT'" Expected CG, SD, DL, DZ or CN block at 0x602b0c8 but found id="b'##AT'" Expected CG, SD, DL, DZ or CN block at 0x602b128 but found id="b'##AT'" Expected CG, SD, DL, DZ or CN block at 0x602b188 but found id="b'##AT'" Expected CG, SD, DL, DZ or CN block at 0x602b1e8 but found id="b'##AT'" 4.00

Code snippet

please write here the code snippet that triggers the error

asam_mdfdata = MDF4(mdf_file)

Traceback

please write here the error traceback There is no error traceback.

Description

Please describe the issue here. After reading the file: Following things gets printed in console

asam_mdfdata = MDF4(mdf_file) Expected CG, SD, DL, DZ or CN block at 0x602b008 but found id="b'##AT'" Expected CG, SD, DL, DZ or CN block at 0x602b068 but found id="b'##AT'" Expected CG, SD, DL, DZ or CN block at 0x602b0c8 but found id="b'##AT'" Expected CG, SD, DL, DZ or CN block at 0x602b128 but found id="b'##AT'" Expected CG, SD, DL, DZ or CN block at 0x602b188 but found id="b'##AT'" Expected CG, SD, DL, DZ or CN block at 0x602b1e8 but found id="b'##AT'"

Even if i use asammdf.MDF module to read MF4 file , i still get same output on console

test = asammdf.MDF(name = mdf_file) Expected CG, SD, DL, DZ or CN block at 0x602b008 but found id="b'##AT'" Expected CG, SD, DL, DZ or CN block at 0x602b068 but found id="b'##AT'" Expected CG, SD, DL, DZ or CN block at 0x602b0c8 but found id="b'##AT'" Expected CG, SD, DL, DZ or CN block at 0x602b128 but found id="b'##AT'" Expected CG, SD, DL, DZ or CN block at 0x602b188 but found id="b'##AT'" Expected CG, SD, DL, DZ or CN block at 0x602b1e8 but found id="b'##AT'"

danielhrisca commented 6 years ago

Hi,

replace the block at https://github.com/danielhrisca/asammdf/blob/master/asammdf/mdf_v4.py#L783 with this

                for i, signal_data_addr in enumerate(sig_data_list):
                    if signal_data_addr == 0x602b188:
                        print(grp['channels'][i])
                    sig_data_list[i] = self._load_signal_data(
                        address=signal_data_addr,
                        stream=stream,
                    )
gdu2003 commented 6 years ago

Did that, see the new output below:

asammdf.MDF(mdf_file)

Expected CG, SD, DL, DZ or CN block at 0x602b008 but found id="b'##AT'" Expected CG, SD, DL, DZ or CN block at 0x602b068 but found id="b'##AT'" Expected CG, SD, DL, DZ or CN block at 0x602b0c8 but found id="b'##AT'" Expected CG, SD, DL, DZ or CN block at 0x602b128 but found id="b'##AT'" Expected CG, SD, DL, DZ or CN block at 0x602b188 but found id="b'##AT'" Expected CG, SD, DL, DZ or CN block at 0x602b1e8 but found id="b'##AT'" <Channel (name: VIDEO_TIMECODE, unit: s, comment: Time offset in seconds into the attached video fileVIDEO_TIMECODE\LEFTSIDE0.000100, address: 0x9df008, conversion: <ChannelConversion (name: , unit: , comment: , formula: , referenced blocks: {}, address: 0x6fe1b0, fields: {'max_phy_value': 0.0, 'id': b'##CC', 'unit_addr': 0, 'precision': 0, 'links_nr': 4, 'ref_param_nr': 0, 'reserved0': 0, 'val_param_nr': 0, 'flags': 0, 'block_len': 80, 'conversion_type': 0, 'inv_conv_addr': 0, 'name_addr': 0, 'min_phy_value': 0.0, 'comment_addr': 0})>, source: <SourceInformation (name: , path: LEFTSIDE, comment: , address: 0x9defd0, fields: {'id': b'##SI', 'bus_type': 0, 'path_addr': 5522304, 'links_nr': 3, 'reserved0': 0, 'flags': 0, 'source_type': 2, 'block_len': 56, 'reserved1': b'\x00\x00\x00\x00\x00', 'name_addr': 0, 'comment_addr': 0})>, fields: {'id': b'##CN', 'pos_invalidation_bit': 0, 'sync_type': 1, 'unit_addr': 5522576, 'component_addr': 0, 'max_raw_value': 0.0, 'precision': 48, 'bit_offset': 0, 'bit_count': 64, 'upper_limit': 0.0, 'byte_offset': 8, 'lower_ext_limit': 0.0, 'min_raw_value': 0.0, 'channel_type': 4, 'reserved1': 0, 'block_len': 160, 'source_addr': 10350544, 'comment_addr': 5522344, 'data_block_addr': 100839816, 'data_type': 4, 'conversion_addr': 7331920, 'name_addr': 5522264, 'attachment_nr': 0, 'links_nr': 8, 'lower_limit': 0.0, 'next_ch_addr': 0, 'flags': 0, 'reserved0': 0, 'upper_ext_limit': 0.0})>

Out[61]: <asammdf.mdf.MDF at 0x2d47a9e8>

asammdf.MDF4(mdf_file)

Expected CG, SD, DL, DZ or CN block at 0x602b008 but found id="b'##AT'" Expected CG, SD, DL, DZ or CN block at 0x602b068 but found id="b'##AT'" Expected CG, SD, DL, DZ or CN block at 0x602b0c8 but found id="b'##AT'" Expected CG, SD, DL, DZ or CN block at 0x602b128 but found id="b'##AT'" Expected CG, SD, DL, DZ or CN block at 0x602b188 but found id="b'##AT'" Expected CG, SD, DL, DZ or CN block at 0x602b1e8 but found id="b'##AT'" <Channel (name: VIDEO_TIMECODE, unit: s, comment: Time offset in seconds into the attached video fileVIDEO_TIMECODE\LEFTSIDE0.000100, address: 0x9df008, conversion: <ChannelConversion (name: , unit: , comment: , formula: , referenced blocks: {}, address: 0x6fe1b0, fields: {'max_phy_value': 0.0, 'id': b'##CC', 'unit_addr': 0, 'precision': 0, 'links_nr': 4, 'ref_param_nr': 0, 'reserved0': 0, 'val_param_nr': 0, 'flags': 0, 'block_len': 80, 'conversion_type': 0, 'inv_conv_addr': 0, 'name_addr': 0, 'min_phy_value': 0.0, 'comment_addr': 0})>, source: <SourceInformation (name: , path: LEFTSIDE, comment: , address: 0x9defd0, fields: {'id': b'##SI', 'bus_type': 0, 'path_addr': 5522304, 'links_nr': 3, 'reserved0': 0, 'flags': 0, 'source_type': 2, 'block_len': 56, 'reserved1': b'\x00\x00\x00\x00\x00', 'name_addr': 0, 'comment_addr': 0})>, fields: {'id': b'##CN', 'pos_invalidation_bit': 0, 'sync_type': 1, 'unit_addr': 5522576, 'component_addr': 0, 'max_raw_value': 0.0, 'precision': 48, 'bit_offset': 0, 'bit_count': 64, 'upper_limit': 0.0, 'byte_offset': 8, 'lower_ext_limit': 0.0, 'min_raw_value': 0.0, 'channel_type': 4, 'reserved1': 0, 'block_len': 160, 'source_addr': 10350544, 'comment_addr': 5522344, 'data_block_addr': 100839816, 'data_type': 4, 'conversion_addr': 7331920, 'name_addr': 5522264, 'attachment_nr': 0, 'links_nr': 8, 'lower_limit': 0.0, 'next_ch_addr': 0, 'flags': 0, 'reserved0': 0, 'upper_ext_limit': 0.0})>

Out[62]: <asammdf.mdf_v4.MDF4 at 0x42653dd8>

It is not causing any issue in reading MF4 file i am getting all the Signals.

danielhrisca commented 6 years ago

There is a video attachment which is referenced by your channel. There is no error in the sense that you probably don't need to handle the video frames in Python, but a tool such as CANape can use the video stream. In the current implementation the video attachment link is lost if you perform operations that create new files (cut, convert, concatenate, filter, stack)

danielhrisca commented 6 years ago

@gdu2003 can you check if the latest development code works correctly?

danielhrisca commented 6 years ago

Please re-open if there are still errors.