Skip to content

Setting index of CAN channel in python API #23

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

Open
mthaitjema opened this issue Aug 7, 2023 · 1 comment
Open

Setting index of CAN channel in python API #23

mthaitjema opened this issue Aug 7, 2023 · 1 comment

Comments

@mthaitjema
Copy link

Hi,

I am trying to load and decode an MF4 file using the python API. In the MATLAB API, the index of the CAN channel is passed to the read method:

can_idx = 8;
rawTimeTable = read(m,can_idx,m.ChannelNames{can_idx});

I could not find out how to do the same thing when using the python API. Currently my code looks like this:

db = can_decoder.load_dbc(pathToDBC)
df_decoder = can_decoder.DataFrameDecoder(db)

with open(pathToMF4, "rb") as handle:
    mdf_file = mdf_iter.MdfFile(handle)
    df_raw = mdf_file.get_data_frame()

df = df_decoder.decode_frame(df_raw)

This does decode the data, but the dataframe is not ordered in groups like when using MATLAB. Is it possible to do this with the python API?

@MatinF
Copy link
Contributor

MatinF commented Aug 7, 2023

You might be able to do something like this with the asammdf Python API. However, our Python API instead converts the MF4 channel-structure to a pandas dataframe structure (similar to a CSV).

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

No branches or pull requests

2 participants