ratal / mdfreader

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

How to rename properly the name of time channels #169

Closed laurentvm closed 4 years ago

laurentvm commented 4 years ago

Hi,

When listing the channels I get this: "t_21_21": [ "t_21_21", "GEN_Generator", "GEN_ManuID_Asic", "GEN_AsicID" ],

The issue is that in matlab, I cannot identify anymore that GEN_Hersteller should use the time vector t_21_21.

I had in mind to rename t_21_21 to GEN_time, that is one possibility, or also to create a time vector for each signal:

GEN_AsicID GEN_AsicID_time GEN_Generator GEN_Generator_time

Any idea on how to do it with your library?

laurentvm commented 4 years ago

I found one way in export_to_matlab:

                if len(channel_name) > 0 and channel_name is not None:
                    if channel_name == "t_19_19":
                        channel_name="RDK_time"

A translation dico could be used to export channels with new name.

ratal commented 4 years ago

Hi To rename a channel, I would advise you to rather use the already existing method .rename_channel(channel_name, new_name) ; it will have correct internal considerations. For Matlab, I would advise you to use instead hdf5 export. It will keep the channel groups structures from mdf and its related master channel like time. Another way could be to resample you complete file to have only one time channel and export to Matlab.

laurentvm commented 4 years ago

Hi,

I first try the HDF export to see how it looks like. Not sure it is right as I get this view when importing in maltab

image

Exporting in linux and reading on Matlab windows.

ratal commented 4 years ago

How do you open your hdf5 in Matlab ? .mat from Matlab is HDF5 with a specific structure that is not the same as the one expected by Matlab. If you import the data from context list, maybe you where trying to parse a text file which is not hdf5. you should use h5disp or h5info and h5read.

ratal commented 4 years ago

I guess ti was mismanipulation, closing