A package for reading and writing MDF files
Project description
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
# load file metadata in memory
obj = mdfr.Mdfr('path/to/file.mdf')
# loads all data in memory
obj.load_all_channels_data_in_memory()
# loads a set of channels in memory, for instance in case there is not enough free memory or for performance
obj.load_channels_data_in_memory({'Channel1', 'Channel2'})
# Returns the numpy array
obj.get_channel_data('channel_name')
# .get_channel_* methods to retrieve channel description, unit, related master name, type and data
# .set_channel_* methods to modify channel description, unit, related master name, type and data
# list of channels in file, or lists of channels grouped by master are available
obj.get_master_channel_names_set()
# To manipulate the file data (cut, resample, merge, etc.), it is possible to use polars:
obj.get_polars_series('channel_name') # returns the a serie
# to get complete dataframe including given channel:
obj.get_polars_dataframe('channel_name')
# add and remove channel
obj.add_channel(channel_name, data, master_channel, master_type, master_flag, unit, description)
# to plot a single channel with matplotlib:
obj.plot('channel_name')
# Export to parquet:
obj.export_to_parquet('file_name', compression_option)
# Export to hdf5:
obj.export_to_hdf5('file_name')
# write to mdf4 file, compressed or not
obj.write('file_name', conpression_algo)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for mdfr-0.6.2-cp312-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dbffb20f76250e5d684bcb70830264a36284d641b790c59bf1d53040345f45cb |
|
MD5 | acd616d5d4127211065a1cedfe632956 |
|
BLAKE2b-256 | 2d2d0c27a0a994f0df49574d62395fe1ff2136054de38078c2b588dfb475857d |
Hashes for mdfr-0.6.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 870bca4497ad6b5e6b8fcb167c1327b74941271ca95932574f8ea85b3d8f85d6 |
|
MD5 | 02f4881153d04b7d47a5d775b6c3b0ac |
|
BLAKE2b-256 | 77f0037b72eb3dbc48f4b925f01eabeb60e5e42ab2ffdb650abe07154f631033 |
Hashes for mdfr-0.6.2-cp311-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dbde76b4e853c3eb624d47f088f9fe80a3b9185a465a06da8c0ca6e60a2b3f33 |
|
MD5 | 94d82a251a5535e6e23978b81f63cdb1 |
|
BLAKE2b-256 | ac911a95641f31e70ddcc6d5d05bab83b9a0eb1300793b323705530ecfb7dc4b |
Hashes for mdfr-0.6.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2c07b3c83dc662362fc1aa87b1d662ec61b131789d21274314ed592c356bc9d |
|
MD5 | d2a51013d19be8983b4b0a2e89891378 |
|
BLAKE2b-256 | 4def5c5eaec96e77b8f06fdae01394792c8486fbc7a774c11901a97577530677 |
Hashes for mdfr-0.6.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e923bf04a40243ec5933fe35ce2de05d7952c853995a155506b38ec6627c156 |
|
MD5 | bd020ff40c302ee7c05cab457890196e |
|
BLAKE2b-256 | e7c5a337ec08b68da86e5954bf92bde8efb4af8f7e2f2249b24e57dc72deb0b7 |
Hashes for mdfr-0.6.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d4b861a537758eef63db6992289c23871e76dbfb184695f2e6c481d4d70d6fb |
|
MD5 | 7a3374e0107e18560b397ef68ff7e10a |
|
BLAKE2b-256 | 465f0d54fe445c0f2924d1d21ddd0ea418e14db654e79d0bd49227793ce38210 |
Hashes for mdfr-0.6.2-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8dec91aa813a5b65ca954f75b734a2a67135b091f9a776b36abd3d6312de9d65 |
|
MD5 | d1a586073c05bd82c1305f31f2cf0dca |
|
BLAKE2b-256 | 2a83952465d139b83d82a9c1a96e4e877789ce28ae4ecc7bb159371a7b119fd6 |
Hashes for mdfr-0.6.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1661c37caef653ca40371702a2ebb0e5254c6a6c956113df613d162ba15e18fc |
|
MD5 | 21c98783438d566a926db161a41a8ce5 |
|
BLAKE2b-256 | 13ff51c3f5d0be8562a189499e17e5ac06da0e5a800ee8c7f66c4bd25580d869 |
Hashes for mdfr-0.6.2-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 209cbf83dade44a3e38ddeccb65b9b436f4e47631cdec812b954803072fd1ebc |
|
MD5 | 8dffd2fa499689673b50ac7b271d55b3 |
|
BLAKE2b-256 | efa40a9fe1580f8ead141689e958698950620ab0a27c31d89b82d04f482c8bd6 |
Hashes for mdfr-0.6.2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8b2542db15f3307bb17e5212b8c6d29a13a0690a6ff8d44e9a214a23c0208b7 |
|
MD5 | 8351651ca77c046683888f0e85b49ee4 |
|
BLAKE2b-256 | a9cb134007e53f37efcd9a744cb335f098c7dd789a57c3a667ee1ad10c56fbec |