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 plot byte sample signals in Canape #790

Closed sridhar-eswaran closed 1 year ago

sridhar-eswaran commented 1 year ago

Python version

Please run the following snippet and write the output here

('python=3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64 '
 'bit (AMD64)]')
'os=Windows-10-10.0.19044-SP0'

'numpy=1.23.4'

'asammdf=7.1.1'

Code

MDF version

'4.10'

Code snippet


# channel_list -> List of signals to extract from a large MF4 file

mdf = MDF(mdf_file_path, channels=channel_list, use_display_names=False)

mdf_signal_list = []
for signalname in channels: 
        data = mdf.get(signalname)
        mdf_signal_list.append(data) 

with MDF(version='4.10') as MDF_CONSTRUCTOR:
        MDF_CONSTRUCTOR.append(mdf_signal_list,comment='mdf_file_name')
        MDF_CONSTRUCTOR.save('mdf_subset_path', overwrite=True)

Traceback

No Error

Description

From the original file, I can view the ACCStatus signal as plot in both Canape and asammdf GUI image

But from the subset MF4 file, I am unable to plot (in both tools) image

I can view them as table/ numeric image

Sample signals exported as pkl are shared in the link https://drive.google.com/file/d/1HVFwdkuJN3XC1nQ8wofgKE6hXHNNdmK7/view?usp=sharing Can you help me with this? Is this a limitation or am I doing something wrong? Appreciate your help. [Thanks]

danielhrisca commented 1 year ago

You are appending the scaled values. Use this instead to preserve the raw values and the channel conversion

# channel_list -> List of signals to extract from a large MF4 file

mdf = MDF(mdf_file_path, channels=channel_list, use_display_names=False)
mdf.save('mdf_subset_path.mf4', overwrite=True)
mdf.close()
sridhar-eswaran commented 1 year ago

Thank you very much for your input. It is working after passing the 'raw=True' argument to the 'get' method.

for signalname in channels: 
        data = mdf.get(signalname,raw=True)