Registry / data / asammdf

asammdf

JSON →
library8.8.25pypypi✓ verified 22d ago

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 asammdf
INSTALL
IMPORT
SIG · ASAMMDF
A
asammdf
datapythonv8.8.25
Install
13.4s avg
Import
1356ms
Disk
861MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v8.8.25 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.915 runs
timeout
glibc
py 3.103.915 runs
installs and imports cleanly · install 13.4s · import 1.356s · 863MB
861MB installed
● package 861MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

MDF
from asammdf import MDF
Signal
from asammdf import Signal

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.

import numpy as np from asammdf import MDF, Signal import os # Create a dummy MDF file for demonstration file_name = "example.mdf" # Ensure clean slate for quickstart run if os.path.exists(file_name): os.remove(file_name) # 1. Create some dummy signals time_stamps = np.arange(0, 10, 0.1) signal1_data = np.sin(time_stamps) signal2_data = np.cos(time_stamps) s1 = Signal(samples=signal1_data, timestamps=time_stamps, name='Engine_Speed', unit='rpm') s2 = Signal(samples=signal2_data, timestamps=time_stamps, name='Vehicle_Speed', unit='km/h') # 2. Write signals to a new MDF file (using context manager) with MDF(version='4.10') as mdf_writer: mdf_writer.append([s1, s2], comment='Basic measurement data') mdf_writer.save(file_name, overwrite=True) print(f"Dummy MDF file '{file_name}' created successfully.\n") # 3. Read the MDF file back with MDF(file_name) as mdf_reader: print(f"File version: {mdf_reader.version}") print(f"Available channels: {mdf_reader.channels}") # 4. Access a specific signal by name engine_speed_signal = mdf_reader.get('Engine_Speed') if engine_speed_signal: print(f"\nSignal 'Engine_Speed' unit: {engine_speed_signal.unit}") print(f"Signal 'Engine_Speed' samples (first 5): {engine_speed_signal.samples[:5]}") print(f"Signal 'Engine_Speed' timestamps (first 5): {engine_speed_signal.timestamps[:5]}") # 5. Select multiple signals selected_signals = mdf_reader.select(channels=['Engine_Speed', 'Vehicle_Speed']) print(f"\nSelected signals count: {len(selected_signals)}") # Clean up the dummy file if os.path.exists(file_name): os.remove(file_name) print(f"\nDummy MDF file '{file_name}' cleaned up.")
mdf --version
Debug
Known issues
breakingThe API for accessing signals and channel groups has undergone significant changes in versions leading up to 7.x and beyond. Older patterns, such as direct dictionary-style access to `mdf.channels` or different `get` method signatures, may no longer work or behave as expected.
fix
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.
affects: < 7.0.0
gotchaLoading extremely large MDF files (multiple gigabytes) entirely into memory using `MDF(file_path)` can lead to `MemoryError` and slow performance. The library reads the entire file by default if not specified otherwise.
fix
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]`).
affects: All versions
gotchaPlotting and GUI functionalities are not included in the base `asammdf` installation. Attempting to use `mdf.plot()` or `mdf.gui()` without installing the extra dependencies will result in `ImportError` or `ModuleNotFoundError`.
fix
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.
affects: All versions
breakingAs of recent versions (e.g., 8.x), `asammdf` requires Python 3.10 or newer. Users attempting to install or run `asammdf` on older Python versions (e.g., 3.9 or below) will encounter dependency resolution errors or runtime failures.
fix
Upgrade your Python environment to version 3.10 or newer. Check the `requires_python` metadata on PyPI for the exact minimum version.
affects: >= 8.0.0
gotchaWhile `asammdf` supports both MDF v3 and v4, certain features or metadata structures are exclusive to specific versions. For instance, detailed bus logging (CAN/LIN) metadata and some complex block structures are primarily a v4 feature.
fix
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.
affects: All versions
Errors
Common errors & fixes
SyntaxError: invalid syntax
Using f-strings, which require Python 3.6 or newer, in an older Python version.
fix
Upgrade to Python 3.6 or newer to support f-strings.
ImportError: DLL load failed: The specified module could not be found.
Missing or incompatible dependencies required by asammdf.
fix
Ensure all required dependencies are installed and compatible with your Python version.
AttributeError: module 'canmatrix' has no attribute '_version'
Conflict or issue with the 'canmatrix' module used by asammdf.
fix
Reinstall 'canmatrix' using 'conda install -c conda-forge/label/gcc7 canmatrix'.
Unable to resolve the name py.asammdf.MDF
MATLAB cannot locate the 'asammdf' module or its components.
fix
Verify that MATLAB's Python environment is correctly configured and includes 'asammdf'.
ValueError: time channel is not monotonous increasing
The MDF file contains non-monotonically increasing timestamps.
fix
Check the MDF file for data integrity issues or use tools to correct the timestamps.
Upgrade
Version history
8.8.25latest on PyPI · released Aug 26, 2026
Audit
Dependencies
numpyrequiredCore dependency for numerical data handling.
matplotliboptionalRequired for plotting functionalities (`asammdf[plot]`).
pyqtgraphoptionalRequired for GUI and advanced plotting (`asammdf[gui]`).
PySide6optionalPrimary Qt binding for GUI (`asammdf[gui]`). PyQt6 can also be used.
Agent activity
37 hits · last 30 days
node
32
OpenAI (training)
1
Resources
asammdf — pip install asammdf · libregistry