mdfr
ASAM mdf reader in rust
Currently a personal project to learn rust from past experience with python (mdfreader).
mdfr is currently able to be used from python interpreter (using pyO3) to read mdf 3.x and 4.x files. You can install it with 'pip install mdfr' command.
It can also be used in pure Rust environment as polars, numpy, pyo3 are optional features
Using rayon crate on many parts of the code allows to have faster parsing in a safe and easy way compared to python.
To allow efficient data sharing with many other tools, mdfr stores the data using arrow. Polars (pandas equivalent) use is therefore also straight forward. A C/C++ api is also available allowing to get list of channels, units, description and data using the Arrow CDataInterface.
It can be used the following way with python interpreter:
import mdfr
obj = mdfr.Mdfr('path/to/file.mdf')
obj.load_all_channels_data_in_memory()
obj.load_channels_data_in_memory({'Channel1', 'Channel2'})
obj.get_channel_data('channel_name')
obj.get_master_channel_names_set()
obj.get_polars_series('channel_name')
obj.get_polars_dataframe('channel_name')
obj.add_channel(channel_name, data, master_channel, master_type, master_flag, unit, description)
obj.plot('channel_name')
obj.export_to_parquet('file_name', compression_option)
obj.export_to_hdf5('file_name')
obj.write('file_name', conpression_algo)