Replies: 1 comment
-
you should focus on creating a new MDF files with the processed data |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to develop code that would modify MDF4 files. The files I'm working with often have data logged from vehicles, and I'm trying to extract data logged in the MDF4 file into a pandas Dataframe, modify the data payloads, and re-insert the data back into the MDF. The issue I'm facing is in re-inserting the new data back into the MDF4 file. My code looks like this:
base_group_data = base_mdf.get_group(group_idx_to_get)
base_group = base_mdf.groups.pop(group_idx_to_get)
# modify the dataframe base_group_data
# NOTE: The input and output dataframes have the same columns and use the same datatypes
# re-insert the data back into the MDF handle
base_mdf.save("modified_mdf.MF4")
I have tried a couple of approaches:
merged_signals = []
for column in base_group_data:
signal = Signal(samples=merged_df[column].values, timestamps=merged_df.index.values, name=column)
merged_signals.append(signal)
base_mdf.append(merged_signals, acq_name=channel, common_timebase=True)
base_mdf.groups.insert(group_idx_to_get, merged_signals)
I'm new to Python and MDF files in general so any help is appreciated! Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions