Skip to main content

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 be used in pure Rust environment as python-polars, numpy, pyo3 are optional features. You can use the Mdfr struct with its methods and eventually its rust-polars methods to manipulate data. Using rayon crate on many parts of the code allows to have fast 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 polars series
# 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)

It can also be used from Rust directly with the polars feature enabled:

# Cargo.toml
[dependencies]
mdfr = { version = "0.6", features = ["polars"] }
use mdfr::mdfreader::Mdf;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut mdf = Mdf::new("path/to/file.mf4")?;
    mdf.load_all_channels_data_in_memory()?;

    // Single channel as a Polars Series
    let series = mdf.get_channel_polars_series("channel_name")?;
    println!("{}", series);

    // All channels sharing a master as a DataFrame
    // pass None for channels that have no master channel
    let df = mdf.get_channel_polars_dataframe(Some("master_channel_name"))?;
    println!("{}", df);

    // All channel groups as a map of DataFrames keyed by master channel name
    let dataframes = mdf.get_polars_dataframes()?;
    for (master, df) in &dataframes {
        println!("master: {:?}\n{}", master, df);
    }

    Ok(())
}

Metadata

Release files for mdfr 0.7.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for mdfr 0.7.4
File Actions
mdfr-0.7.4-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details for mdfr-0.7.4-cp314-cp314-win_amd64.whl
mdfr-0.7.4-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details for mdfr-0.7.4-cp314-cp314-macosx_11_0_arm64.whl
mdfr-0.7.4-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for mdfr-0.7.4-cp313-cp313-win_amd64.whl
mdfr-0.7.4-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details for mdfr-0.7.4-cp313-cp313-macosx_11_0_arm64.whl
mdfr-0.7.4-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for mdfr-0.7.4-cp312-cp312-win_amd64.whl
mdfr-0.7.4-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details for mdfr-0.7.4-cp312-cp312-macosx_11_0_arm64.whl
mdfr-0.7.4-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for mdfr-0.7.4-cp311-cp311-win_amd64.whl
mdfr-0.7.4-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details for mdfr-0.7.4-cp311-cp311-macosx_11_0_arm64.whl
mdfr-0.7.4-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details for mdfr-0.7.4-cp310-cp310-win_amd64.whl
mdfr-0.7.4-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details for mdfr-0.7.4-cp310-cp310-macosx_11_0_arm64.whl
mdfr-0.7.4-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details for mdfr-0.7.4-cp39-cp39-win_amd64.whl
mdfr-0.7.4-cp39-cp39-macosx_11_0_arm64.whl CPython 3.9 CPython 3.9 macOS 11.0+ ARM64 Details for mdfr-0.7.4-cp39-cp39-macosx_11_0_arm64.whl

Total release size: 50.0 MB

Release files / mdfr-0.7.4-cp314-cp314-win_amd64.whl

Download URL mdfr-0.7.4-cp314-cp314-win_amd64.whl
Size 4.3 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
9573de5d933f8b8b8625b5df28a03bdfc7009ac7d0cc9efa17696709639b45d4
BLAKE2b-256 checksum
How to use checksums
411ed4740825ff16487e0c98575ec0a493d895758004eada4f81390b20d7b351
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / mdfr-0.7.4-cp314-cp314-macosx_11_0_arm64.whl

Download URL mdfr-0.7.4-cp314-cp314-macosx_11_0_arm64.whl
Size 4.1 MB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ddfb6f7b1a45371e099a15c02ee6a08f04ab1e82694b01748bbe838cce007cdd
BLAKE2b-256 checksum
How to use checksums
37e1a33e4e71fac3aafcc980323ea2ee1ac8bafbd39419695249bdf7822e1436
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / mdfr-0.7.4-cp313-cp313-win_amd64.whl

Download URL mdfr-0.7.4-cp313-cp313-win_amd64.whl
Size 4.3 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
0426c73a864e62c58c45345e7b1f13a65d762c65d86168e17ad5e29ad1147ab0
BLAKE2b-256 checksum
How to use checksums
dc64e79c1ac6c5a368ff194eb37ed8451b516043cb4fe0507ddc31dcf1864334
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / mdfr-0.7.4-cp313-cp313-macosx_11_0_arm64.whl

Download URL mdfr-0.7.4-cp313-cp313-macosx_11_0_arm64.whl
Size 4.1 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
50bd51d342374e843a069c9d05ab7455de50d57447d08c7ec79383c42942f4fe
BLAKE2b-256 checksum
How to use checksums
27d9d97bf326c93ecfe01632a313fe9bfde5f0647d4416e4c00945e7e40ba097
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / mdfr-0.7.4-cp312-cp312-win_amd64.whl

Download URL mdfr-0.7.4-cp312-cp312-win_amd64.whl
Size 4.3 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
f1b2fb8e9b776260ce88595311aa1ddfc31e8e676a7a5dd015ec00f5a6689fd8
BLAKE2b-256 checksum
How to use checksums
8b959592cc89e1cdf058ca6fe997e02ff0aa552cad92c9007709c365ae0ca567
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / mdfr-0.7.4-cp312-cp312-macosx_11_0_arm64.whl

Download URL mdfr-0.7.4-cp312-cp312-macosx_11_0_arm64.whl
Size 4.1 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8d34229640acd12188099b656526598e4355bc7589ed3dd9a3ce0d31216f0c5a
BLAKE2b-256 checksum
How to use checksums
4ebd3b08b13b6c3da91fb41ca90d8ad84cac6692f26ba85338e8ad1381e285e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / mdfr-0.7.4-cp311-cp311-win_amd64.whl

Download URL mdfr-0.7.4-cp311-cp311-win_amd64.whl
Size 4.3 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
5edcad0b5039046abe768ca6b6262a56e20b59c4415853f794411ff9710d5574
BLAKE2b-256 checksum
How to use checksums
38c282e96e14e90e5824d9e94a690d909b7f2855b86279fd6e618c5d04804485
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / mdfr-0.7.4-cp311-cp311-macosx_11_0_arm64.whl

Download URL mdfr-0.7.4-cp311-cp311-macosx_11_0_arm64.whl
Size 4.1 MB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
75df30880967a1870b01462d4d3098af35b95bf2cdb225b9d110417dab70f7c6
BLAKE2b-256 checksum
How to use checksums
11c3afd154656860fdfb6afab1cae6f98375fb2b2a300620d32bf867fc68b213
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / mdfr-0.7.4-cp310-cp310-win_amd64.whl

Download URL mdfr-0.7.4-cp310-cp310-win_amd64.whl
Size 4.3 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
778829b11747d27d247ba0a441f9536a1fdbe9bb9658770baa80438e4c7da978
BLAKE2b-256 checksum
How to use checksums
47086ef6e947cc6682b055eeff5370e6f790d73103092ac43d8378eb5f904874
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / mdfr-0.7.4-cp310-cp310-macosx_11_0_arm64.whl

Download URL mdfr-0.7.4-cp310-cp310-macosx_11_0_arm64.whl
Size 4.1 MB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8d46e0b101e06a846cff697d224d7072ea3753ae84dfb884c0e1adc7d3cc413e
BLAKE2b-256 checksum
How to use checksums
699288f3b2a7186023f261581db288ad9562fdc40d6a9779323fb5b49a866ff7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / mdfr-0.7.4-cp39-cp39-win_amd64.whl

Download URL mdfr-0.7.4-cp39-cp39-win_amd64.whl
Size 4.3 MB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
ae62e8372c9b0a01b4032dbcffc682f60b248f151905b9ee5547dabfdf7d555b
BLAKE2b-256 checksum
How to use checksums
50e727fcaac4297d5c23caae1f05a15dbe7d008d28e0950316945298b335a29c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / mdfr-0.7.4-cp39-cp39-macosx_11_0_arm64.whl

Download URL mdfr-0.7.4-cp39-cp39-macosx_11_0_arm64.whl
Size 4.1 MB
Tags CPython 3.9 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0513316b9ea580eb970c367aa9f5d4ef4a6804df485b9509f20f2bcb8a92cbdf
BLAKE2b-256 checksum
How to use checksums
21b9a28fbedde571620edfbeb634624099d13d4a73c4167d19c1ed24d42260d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for mdfr 0.7.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page