asammdf is a Python library for parsing and manipulating ASAM MDF (Measurement Data Format) files. It supports MDF versions 3 and 4, providing robust tools for reading, writing, and modifying measurement data. The library is currently at version 8.8.1 and maintains a frequent release cadence, often pushing several bug fix releases per month.
pip install asammdfVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to create an MDF file with sample data, save it, and then load it to retrieve signal information. It uses `MDF` as a context manager for proper file handling and showcases basic signal creation and access by name.
Migrate to the current API: use `mdf.get(channel_name)` for single signals and `mdf.select(channels=[...])` for multiple signals. Use `mdf.iter_groups()` for iterating over channel groups.
For large files, utilize methods like `mdf.iter_get_channels()` to process data in chunks or specify `MDF(file_path, memory='low')` to hint at lower memory usage, which might involve more disk I/O. Use slicing on signals to read only parts of the data (e.g., `signal.samples[start:end]`).
Install `asammdf` with the appropriate extras: `pip install "asammdf[plot]"` for plotting or `pip install "asammdf[gui]"` for the GUI, which also includes plotting dependencies.
Upgrade your Python environment to version 3.10 or newer. Check the `requires_python` metadata on PyPI for the exact minimum version.
Be aware of the MDF file version you are working with. When writing files, specify `MDF(version='4.10')` to leverage v4 features. When reading, understand that some metadata might not be available or structured differently in v3 files.
Upgrade to Python 3.6 or newer to support f-strings.
Ensure all required dependencies are installed and compatible with your Python version.
Reinstall 'canmatrix' using 'conda install -c conda-forge/label/gcc7 canmatrix'.
Verify that MATLAB's Python environment is correctly configured and includes 'asammdf'.
Check the MDF file for data integrity issues or use tools to correct the timestamps.