LincolnG4 / GoMDF

ASAM MDF / MF4 (Measurement Data Format) files editor in GoLang
MIT License
9 stars 0 forks source link

[feature] get the signal unit #44

Open sccds opened 2 days ago

sccds commented 2 days ago

in python asammdf, we can get the signal unit from the file

path = "xxx.mf4"
mdf_ori = MDF(path)

mdf_info_dict = mdf_ori.info()
groups_count = mdf_info_dict.get("groups")
group_channel_dict = dict()

for i in range(groups_count):
    channel_count = mdf_info_dict.get("group {}".format(i)).get("channels count")
    cycles = mdf_info_dict.get("group {}".format(i)).get("cycles")
    group_channel_dict[i] = (channel_count, cycles)

    for j in range(1, channel_count):
        name = mdf_ori.get_channel_name(group=i, index=j)
        unit = mdf_ori.get_channel_unit(group=i, index=j)
        comment = mdf_ori.get_channel_comment(group=i, index=j)
        print((name, unit, comment))

image

does the GoMDF support unit?

for this code, I can get the signal comment by using xml unmarshal