#
<img align="left" src="https://raw.githubusercontent.com/danielhrisca/asammdf/master/asammdf.png" alt="logo of asammdf" width="128" height="128" />
_asammdf_ is a fast parser and editor for ASAM (Association for Standardization of Automation and Measuring Systems) MDF (Measurement Data Format) files.
_asammdf_ supports MDF versions 2 (.dat), 3 (.mdf) and 4 (.mf4).
_asammdf_ works on Python >= 3.10




[](https://mypy-lang.org/)
[](https://github.com/pre-commit/pre-commit)
[](https://github.com/astral-sh/ruff)
---

## Status
| Continuous Integration | Coveralls | Codacy | ReadTheDocs |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| [](https://github.com/danielhrisca/asammdf/actions/workflows/main.yml) | [](https://coveralls.io/github/danielhrisca/asammdf?branch=master) | [](https://www.codacy.com/app/danielhrisca/asammdf?utm_source=github.com&utm_medium=referral&utm_content=danielhrisca/asammdf&utm_campaign=badger) | [](http://asammdf.readthedocs.io/en/master/?badge=stable) |
| PyPI | conda-forge |
| ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| [](https://badge.fury.io/py/asammdf) | [](https://anaconda.org/conda-forge/asammdf) |
## Project goals
The main goals for this library are:
- to be faster than the other Python-based mdf libraries
- to have clean and easy-to-understand code base
- to have minimal 3rd party dependencies
## Features
- create new mdf files from scratch
- append new channels
- read unsorted MDF v3 and v4 files
- read CAN and LIN bus logging files
- extract CAN and LIN signals from anonymous bus logging measurements
- filter a subset of channels from original mdf file
- cut measurement to specified time interval
- convert to different mdf version
- export to pandas, HDF5, Matlab (v7.3), CSV and parquet
- merge multiple files sharing the same internal structure
- read and save mdf version 4.10 files containing zipped data blocks
- space optimizations for saved files (no duplicated blocks)
- split large data blocks (configurable size) for mdf version 4
- full support (read, append, save) for the following map types (multidimensional array channels):
- mdf version 3 channels with CDBLOCK
- mdf version 4 structure channel composition
- mdf version 4 channel arrays with CNTemplate storage and one of the array types:
- 0 - array
- 1 - scaling axis
- 2 - look-up
- add and extract attachments for mdf version 4
- handle large files (for example merging two files, each with 14000 channels and 5GB size, on a RaspberryPi)
- extract channel data, master channel and extra channel information as _Signal_ objects for unified operations with v3 and v4 files
- time domain operation using the _Signal_ class
- pandas DataFrames are good if all the channels have the same time base
- a measurement will usually have channels from different sources at different rates
- the _Signal_ class facilitates operations with such channels
- graphical interface to visualize channels and perform operations with the files
## Major features not implemented (yet)
- for version 3
- functionality related to sample reduction block: the sample reduction blocks are simply ignored
- for version 4
- experimental support for MDF v4.20 column oriented storage
- functionality related to sample reduction block: the sample reduction blocks are simply ignored
- handling of channel hierarchy: channel hierarchy is ignored
- full handling of bus logging measurements: currently only CAN and LIN bus logging are implemented with the
ability to _get_ signals defined in the attached CAN/LIN database (.arxml or .dbc). Signals can also
be extracted from an anonymous bus logging measurement by providing a CAN or LIN database (.dbc or .arxml)
- handling of unfinished measurements (mdf 4): finalization is attempted when the file is loaded, however
not all the finalization steps are supported
- full support for remaining mdf 4 channel arrays types
- xml schema for MDBLOCK: most metadata stored in the comment blocks will not be available
- full handling of event blocks: events are transferred to the new files (in case of calling methods
that return new _MDF_ objects) but no new events can be created
- channels with default X axis: the default X axis is ignored and the channel group's master channel
is used
- attachment encryption/decryption using user provided encryption/decryption functions; this is not
part of the MDF v4 spec and is only supported by this library
## Usage
```python
from asammdf import MDF
mdf = MDF('sample.mdf')
speed = mdf.get('WheelSpeed')
speed.plot()
important_signals = ['WheelSpeed', 'VehicleSpeed', 'VehicleAcceleration']
# get short measurement with a subset of channels from 10s to 12s
short = mdf.filter(important_signals).cut(start=10, stop=12)
# convert to version 4.10 and save to disk
short.convert('4.10').save('important signals.mf4')
# plot some channels from a huge file
efficient = MDF('huge.mf4')
for signal in efficient.select(['Sensor1', 'Voltage3']):
signal.plot()
```
Check the _examples_ folder for extended usage demo, or the documentation
<http://asammdf.readthedocs.io/en/master/examples.html>
<https://canlogger.csselectronics.com/canedge-getting-started/ce3/log-file-tools/asammdf-gui/>
## Documentation
<http://asammdf.readthedocs.io/en/master>
And a nicely written tutorial on the [CSS Electronics site](https://canlogger.csselectronics.com/canedge-getting-started/ce3/log-file-tools/asammdf-gui/).
## Contributing & Support
Please have a look at the [contributing guidelines](CONTRIBUTING.md).
If you enjoy this library please consider making a donation to the
[numpy project](https://numfocus.org/donate-to-numpy) or to [danielhrisca using liberapay](https://liberapay.com/danielhrisca/donate).
[](https://liberapay.com/danielhrisca/donate)
### Contributors
Thanks to all who contributed with commits to _asammdf_:
[](https://github.com/danielhrisca/asammdf/graphs/contributors)
## Installation
_asammdf_ is available on
- GitHub: <https://github.com/danielhrisca/asammdf/>
- PyPI: <https://pypi.org/project/asammdf/>
- conda-forge: <https://anaconda.org/conda-forge/asammdf>
```shell
pip install asammdf
# for the GUI
pip install asammdf[gui]
# or for anaconda
conda install -c conda-forge asammdf
```
In case a wheel is not present for your OS/Python versions and you
lack the proper compiler setup to compile the C-extension code, then
you can simply copy-paste the package code to your site-packages. In this
way the Python fallback code will be used instead of the compiled C-extension code.
## Dependencies
asammdf uses the following libraries
- numpy : the heart that makes all tick
- numexpr : for algebraic and rational channel conversions
- wheel : for installation in virtual environments
- pandas : for DataFrame export
- canmatrix : to handle CAN/LIN bus logging measurements
- natsort
- lxml : for canmatrix arxml support
- lz4 : to speed up the disk IO performance
- python-dateutil : measurement start time handling
Optional dependencies needed for exports
- h5py : for HDF5 export
- hdf5storage : for Matlab v7.3 .mat export
- pyarrow : for parquet export
- scipy: for Matlab v4 and v5 .mat export
Other optional dependencies
- PySide6 : for GUI tool
- pyqtgraph : for GUI tool and Signal plotting
- matplotlib : as fallback for Signal plotting
- faust-cchardet : to detect non-standard Unicode encodings
- chardet : to detect non-standard Unicode encodings
- pyqtlet2 : for the GPS window
- isal : for faster zlib compression/decompression
- fsspec : access files stored in the cloud
## Benchmarks
<http://asammdf.readthedocs.io/en/master/benchmarks.html>
Raw data
{
"_id": null,
"home_page": null,
"name": "asammdf",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "read, reader, edit, editor, parse, parser, asam, mdf, measurement",
"author": null,
"author_email": "Daniel Hrisca <daniel.hrisca@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/82/78/d14700ca566f01fcc859da445609d4901350021a265389366e4fc18e63b9/asammdf-8.7.0.tar.gz",
"platform": null,
"description": "#\n\n<img align=\"left\" src=\"https://raw.githubusercontent.com/danielhrisca/asammdf/master/asammdf.png\" alt=\"logo of asammdf\" width=\"128\" height=\"128\" />\n\n_asammdf_ is a fast parser and editor for ASAM (Association for Standardization of Automation and Measuring Systems) MDF (Measurement Data Format) files.\n\n_asammdf_ supports MDF versions 2 (.dat), 3 (.mdf) and 4 (.mf4).\n\n_asammdf_ works on Python >= 3.10\n\n\n\n\n\n[](https://mypy-lang.org/)\n[](https://github.com/pre-commit/pre-commit)\n[](https://github.com/astral-sh/ruff)\n\n---\n\n\n\n## Status\n\n| Continuous Integration | Coveralls | Codacy | ReadTheDocs |\n| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |\n| [](https://github.com/danielhrisca/asammdf/actions/workflows/main.yml) | [](https://coveralls.io/github/danielhrisca/asammdf?branch=master) | [](https://www.codacy.com/app/danielhrisca/asammdf?utm_source=github.com&utm_medium=referral&utm_content=danielhrisca/asammdf&utm_campaign=badger) | [](http://asammdf.readthedocs.io/en/master/?badge=stable) |\n\n| PyPI | conda-forge |\n| ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |\n| [](https://badge.fury.io/py/asammdf) | [](https://anaconda.org/conda-forge/asammdf) |\n\n## Project goals\n\nThe main goals for this library are:\n\n- to be faster than the other Python-based mdf libraries\n- to have clean and easy-to-understand code base\n- to have minimal 3rd party dependencies\n\n## Features\n\n- create new mdf files from scratch\n- append new channels\n- read unsorted MDF v3 and v4 files\n- read CAN and LIN bus logging files\n- extract CAN and LIN signals from anonymous bus logging measurements\n- filter a subset of channels from original mdf file\n- cut measurement to specified time interval\n- convert to different mdf version\n- export to pandas, HDF5, Matlab (v7.3), CSV and parquet\n- merge multiple files sharing the same internal structure\n- read and save mdf version 4.10 files containing zipped data blocks\n- space optimizations for saved files (no duplicated blocks)\n- split large data blocks (configurable size) for mdf version 4\n- full support (read, append, save) for the following map types (multidimensional array channels):\n - mdf version 3 channels with CDBLOCK\n - mdf version 4 structure channel composition\n - mdf version 4 channel arrays with CNTemplate storage and one of the array types:\n - 0 - array\n - 1 - scaling axis\n - 2 - look-up\n- add and extract attachments for mdf version 4\n- handle large files (for example merging two files, each with 14000 channels and 5GB size, on a RaspberryPi)\n- extract channel data, master channel and extra channel information as _Signal_ objects for unified operations with v3 and v4 files\n- time domain operation using the _Signal_ class\n - pandas DataFrames are good if all the channels have the same time base\n - a measurement will usually have channels from different sources at different rates\n - the _Signal_ class facilitates operations with such channels\n- graphical interface to visualize channels and perform operations with the files\n\n## Major features not implemented (yet)\n\n- for version 3\n - functionality related to sample reduction block: the sample reduction blocks are simply ignored\n- for version 4\n - experimental support for MDF v4.20 column oriented storage\n - functionality related to sample reduction block: the sample reduction blocks are simply ignored\n - handling of channel hierarchy: channel hierarchy is ignored\n - full handling of bus logging measurements: currently only CAN and LIN bus logging are implemented with the\n ability to _get_ signals defined in the attached CAN/LIN database (.arxml or .dbc). Signals can also\n be extracted from an anonymous bus logging measurement by providing a CAN or LIN database (.dbc or .arxml)\n - handling of unfinished measurements (mdf 4): finalization is attempted when the file is loaded, however\n not all the finalization steps are supported\n - full support for remaining mdf 4 channel arrays types\n - xml schema for MDBLOCK: most metadata stored in the comment blocks will not be available\n - full handling of event blocks: events are transferred to the new files (in case of calling methods\n that return new _MDF_ objects) but no new events can be created\n - channels with default X axis: the default X axis is ignored and the channel group's master channel\n is used\n - attachment encryption/decryption using user provided encryption/decryption functions; this is not\n part of the MDF v4 spec and is only supported by this library\n\n## Usage\n\n```python\nfrom asammdf import MDF\n\nmdf = MDF('sample.mdf')\nspeed = mdf.get('WheelSpeed')\nspeed.plot()\n\nimportant_signals = ['WheelSpeed', 'VehicleSpeed', 'VehicleAcceleration']\n# get short measurement with a subset of channels from 10s to 12s\nshort = mdf.filter(important_signals).cut(start=10, stop=12)\n\n# convert to version 4.10 and save to disk\nshort.convert('4.10').save('important signals.mf4')\n\n# plot some channels from a huge file\nefficient = MDF('huge.mf4')\nfor signal in efficient.select(['Sensor1', 'Voltage3']):\n signal.plot()\n```\n\nCheck the _examples_ folder for extended usage demo, or the documentation\n<http://asammdf.readthedocs.io/en/master/examples.html>\n\n<https://canlogger.csselectronics.com/canedge-getting-started/ce3/log-file-tools/asammdf-gui/>\n\n## Documentation\n\n<http://asammdf.readthedocs.io/en/master>\n\nAnd a nicely written tutorial on the [CSS Electronics site](https://canlogger.csselectronics.com/canedge-getting-started/ce3/log-file-tools/asammdf-gui/).\n\n## Contributing & Support\n\nPlease have a look at the [contributing guidelines](CONTRIBUTING.md).\n\nIf you enjoy this library please consider making a donation to the\n[numpy project](https://numfocus.org/donate-to-numpy) or to [danielhrisca using liberapay](https://liberapay.com/danielhrisca/donate).\n\n[](https://liberapay.com/danielhrisca/donate)\n\n### Contributors\n\nThanks to all who contributed with commits to _asammdf_:\n\n[](https://github.com/danielhrisca/asammdf/graphs/contributors)\n\n## Installation\n\n_asammdf_ is available on\n\n- GitHub: <https://github.com/danielhrisca/asammdf/>\n- PyPI: <https://pypi.org/project/asammdf/>\n- conda-forge: <https://anaconda.org/conda-forge/asammdf>\n\n```shell\npip install asammdf\n# for the GUI\npip install asammdf[gui]\n# or for anaconda\nconda install -c conda-forge asammdf\n```\n\nIn case a wheel is not present for your OS/Python versions and you\nlack the proper compiler setup to compile the C-extension code, then\nyou can simply copy-paste the package code to your site-packages. In this\nway the Python fallback code will be used instead of the compiled C-extension code.\n\n## Dependencies\n\nasammdf uses the following libraries\n\n- numpy : the heart that makes all tick\n- numexpr : for algebraic and rational channel conversions\n- wheel : for installation in virtual environments\n- pandas : for DataFrame export\n- canmatrix : to handle CAN/LIN bus logging measurements\n- natsort\n- lxml : for canmatrix arxml support\n- lz4 : to speed up the disk IO performance\n- python-dateutil : measurement start time handling\n\nOptional dependencies needed for exports\n\n- h5py : for HDF5 export\n- hdf5storage : for Matlab v7.3 .mat export\n- pyarrow : for parquet export\n- scipy: for Matlab v4 and v5 .mat export\n\nOther optional dependencies\n\n- PySide6 : for GUI tool\n- pyqtgraph : for GUI tool and Signal plotting\n- matplotlib : as fallback for Signal plotting\n- faust-cchardet : to detect non-standard Unicode encodings\n- chardet : to detect non-standard Unicode encodings\n- pyqtlet2 : for the GPS window\n- isal : for faster zlib compression/decompression\n- fsspec : access files stored in the cloud\n\n## Benchmarks\n\n<http://asammdf.readthedocs.io/en/master/benchmarks.html>\n",
"bugtrack_url": null,
"license": "LGPLv3+",
"summary": "ASAM MDF measurement data file parser",
"version": "8.7.0",
"project_urls": {
"Documentation": "https://asammdf.readthedocs.io/en/master",
"Issues": "https://github.com/danielhrisca/asammdf/issues",
"Source": "https://github.com/danielhrisca/asammdf"
},
"split_keywords": [
"read",
" reader",
" edit",
" editor",
" parse",
" parser",
" asam",
" mdf",
" measurement"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "089dd801551c2fddd3926a01842a605b0c1870b135f53f9202623f76d52949f5",
"md5": "6e84307354b8a0114f47f5bc516a3e8b",
"sha256": "f55f9b3b12794fb1a7f1b1c2af97735d37dc189d17a4fb5fe66d7c8d7bd53039"
},
"downloads": -1,
"filename": "asammdf-8.7.0-cp310-abi3-macosx_10_9_x86_64.whl",
"has_sig": false,
"md5_digest": "6e84307354b8a0114f47f5bc516a3e8b",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.10",
"size": 1179405,
"upload_time": "2025-11-03T12:26:34",
"upload_time_iso_8601": "2025-11-03T12:26:34.509851Z",
"url": "https://files.pythonhosted.org/packages/08/9d/d801551c2fddd3926a01842a605b0c1870b135f53f9202623f76d52949f5/asammdf-8.7.0-cp310-abi3-macosx_10_9_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "b52890cdf39108141e11b19320cd55219f12e8dd20ba0c05ad7f7f5da69db694",
"md5": "4762df8224d4ce4255dbb6eb29fa3990",
"sha256": "bbb697bf3117988922feb23464a998a54eb271e9d82157c7bbaa468df143c70a"
},
"downloads": -1,
"filename": "asammdf-8.7.0-cp310-abi3-macosx_11_0_arm64.whl",
"has_sig": false,
"md5_digest": "4762df8224d4ce4255dbb6eb29fa3990",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.10",
"size": 1170167,
"upload_time": "2025-11-03T12:26:36",
"upload_time_iso_8601": "2025-11-03T12:26:36.721869Z",
"url": "https://files.pythonhosted.org/packages/b5/28/90cdf39108141e11b19320cd55219f12e8dd20ba0c05ad7f7f5da69db694/asammdf-8.7.0-cp310-abi3-macosx_11_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "8049baad822fdce28ab8eb878668361587feae612f29243ccdde3c43a9dc31f3",
"md5": "f017ffeba50a79130fcbbcc339901935",
"sha256": "7ff654d702a82d9dd9c24cfacf3d99def8d0c30852815b295f739664d5ed2658"
},
"downloads": -1,
"filename": "asammdf-8.7.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl",
"has_sig": false,
"md5_digest": "f017ffeba50a79130fcbbcc339901935",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.10",
"size": 1174427,
"upload_time": "2025-11-03T12:26:37",
"upload_time_iso_8601": "2025-11-03T12:26:37.993879Z",
"url": "https://files.pythonhosted.org/packages/80/49/baad822fdce28ab8eb878668361587feae612f29243ccdde3c43a9dc31f3/asammdf-8.7.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "64138754027716d223922c953c5f52ad3f30df5669a575ea8db6792218763449",
"md5": "88b58d940a378007255a328f4f8d3218",
"sha256": "092e6d63a095f12399a232f33905548eda4fdcc6c9dd505bd028f182c59b2550"
},
"downloads": -1,
"filename": "asammdf-8.7.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl",
"has_sig": false,
"md5_digest": "88b58d940a378007255a328f4f8d3218",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.10",
"size": 1177190,
"upload_time": "2025-11-03T12:26:39",
"upload_time_iso_8601": "2025-11-03T12:26:39.173489Z",
"url": "https://files.pythonhosted.org/packages/64/13/8754027716d223922c953c5f52ad3f30df5669a575ea8db6792218763449/asammdf-8.7.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "9bdbee07eda381095cab40765493e72da5e16a1d8dc786e67a16381f05377e2c",
"md5": "111eb571dbe858e9cd82cc28e326a0f3",
"sha256": "3b1b6efd96a0f74937dacdf714c973739622a210a8db085d9bb7112d08b0cde7"
},
"downloads": -1,
"filename": "asammdf-8.7.0-cp310-abi3-win_amd64.whl",
"has_sig": false,
"md5_digest": "111eb571dbe858e9cd82cc28e326a0f3",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.10",
"size": 1176899,
"upload_time": "2025-11-03T12:26:40",
"upload_time_iso_8601": "2025-11-03T12:26:40.734138Z",
"url": "https://files.pythonhosted.org/packages/9b/db/ee07eda381095cab40765493e72da5e16a1d8dc786e67a16381f05377e2c/asammdf-8.7.0-cp310-abi3-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "8278d14700ca566f01fcc859da445609d4901350021a265389366e4fc18e63b9",
"md5": "db619ac220758cfce8ceb9d095281667",
"sha256": "7de80f9064d917ad8c772ed8934c8ab1f7927abe24d0d36d8e3e909184904e24"
},
"downloads": -1,
"filename": "asammdf-8.7.0.tar.gz",
"has_sig": false,
"md5_digest": "db619ac220758cfce8ceb9d095281667",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 9153772,
"upload_time": "2025-11-03T12:26:42",
"upload_time_iso_8601": "2025-11-03T12:26:42.536093Z",
"url": "https://files.pythonhosted.org/packages/82/78/d14700ca566f01fcc859da445609d4901350021a265389366e4fc18e63b9/asammdf-8.7.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-11-03 12:26:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "danielhrisca",
"github_project": "asammdf",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"tox": true,
"lcname": "asammdf"
}