Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using method get_channel_data(... , raw_data=True) #168

Closed
bbto89 opened this issue Aug 20, 2019 · 5 comments
Closed

Error when using method get_channel_data(... , raw_data=True) #168

bbto89 opened this issue Aug 20, 2019 · 5 comments

Comments

@bbto89
Copy link

bbto89 commented Aug 20, 2019

Python version

'3.6.9'

Platform information

' Windows 10 Enterprise Version 1809 - Build 17763.678'

Numpy version

'1.16.4'

mdfreader version

'3.2'

Description

After updating to mdfreader version 3.2, I have encountered the following issue:
In my script I am loading a .mf4 file with the option no_data_loading=True.
Later, I read every channel explicitly by calling get_channel_data with the option raw_data=True.
This results in the following error:

File "D:...\converter\format\mdf\converter.py", line 90, in _export
    raw = mdf.get_channel_data(signal.name, raw_data=True)
File "C:...\lib\site-packages\mdfreader\mdfreader.py", line 474, in get_channel_data
    vector = self._get_channel_data4(channel_name, raw_data)
File "C:...\lib\site-packages\mdfreader\mdf4reader.py", line 1457, in _get_channel_data4
    self.read4(file_name=None, info=None, channel_list=[channel_name], convert_after_read=False)
File "C:...\lib\site-packages\mdfreader\mdf4reader.py", line 1277, in read4
    if not info['DG'][dataGroup]['dg_data'] == 0 and
KeyError: (0, 0, 1)

Some further things I noticed:
The code worked properly with an older version of the mdfreader (2.7.6)
Also, the code works if I set the option raw_data=False when calling the get_channel_data method.

@ratal
Copy link
Owner

ratal commented Aug 31, 2019

Hi,
I do not understand the keyerror for this condition check. Can you debug there and tell what are the values several elements in the condition statement ?
Some snapshot from MDFvalidator of the related datagroup and channel group woudl probably also to understand special corner case that is missed in the code.

@bbto89
Copy link
Author

bbto89 commented Sep 2, 2019

import mdfreader

mdf = mdfreader.Mdf('ASAP2_Demo_V171.mf4', no_data_loading=True)
info = mdfreader.MdfInfo('ASAP2_Demo_V171.mf4')
channels = info.list_channels()

for channel in channels:
    values = mdf.get_channel_data(channel)
    raw = mdf.get_channel_data(channel, raw_data=True)

Hi,
the error above happens with the code in this comment using the mf4 example from ASAM.
Link to the mf4 file: https://www.asam.net/standards/detail/mdf/wiki/#Downloads
If no_data_loading is set to False, the code works flawlessly.
Thanks!

@ratal
Copy link
Owner

ratal commented Sep 4, 2019

I pushed modifications that should solve this bug, you can check in dev branch. Thanks for reporting it.

@bbto89
Copy link
Author

bbto89 commented Sep 5, 2019

Hi,

just tested the fix with several files. Works perfectly, thank you!

@bbto89 bbto89 closed this as completed Sep 5, 2019
@bbto89
Copy link
Author

bbto89 commented Sep 10, 2019

Hi,

would you be so kind to release the fix on your master branch?
This would be greatly appreciated. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants