#
<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.9




[](https://github.com/psf/black)
[](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 3-rd 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 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 fileas, 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 data frames are good if all the channels have the same time based
- 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 samples reduction blocks are simply ignored
- for version 4
- experimental support for MDF v4.20 column oriented storage
- functionality related to sample reduction block: the samples 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 the
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 over 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 you 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.9",
"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/30/a9/e3d63d4a2ab292d0a61160190ba3d292088cc5fc76d3805d446978b08309/asammdf-8.1.2.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.9\n\n\n\n\n\n[](https://github.com/psf/black)\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 3-rd 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 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\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\n - 0 - array\n - 1 - scaling axis\n - 2 - look-up\n\n- add and extract attachments for mdf version 4\n- handle large files (for example merging two fileas, 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\n - Pandas data frames are good if all the channels have the same time based\n - a measurement will usually have channels from different sources at different rates\n - the _Signal_ class facilitates operations with such channels\n\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\n - functionality related to sample reduction block: the samples reduction blocks are simply ignored\n\n- for version 4\n\n - experimental support for MDF v4.20 column oriented storage\n - functionality related to sample reduction block: the samples 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 the\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 over 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 you 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.1.2",
"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": "95595572538bf91233da567571c5d4570314176930b83a485af02d6e2983cb90",
"md5": "582cbfdb0116b5acea435122608e47e8",
"sha256": "b017880976f1fb1f57ac6b570aa9fc3bf1097c90d7a174ac92166b59f415d934"
},
"downloads": -1,
"filename": "asammdf-8.1.2-cp39-abi3-macosx_11_0_arm64.whl",
"has_sig": false,
"md5_digest": "582cbfdb0116b5acea435122608e47e8",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 1137748,
"upload_time": "2025-02-26T07:37:19",
"upload_time_iso_8601": "2025-02-26T07:37:19.699048Z",
"url": "https://files.pythonhosted.org/packages/95/59/5572538bf91233da567571c5d4570314176930b83a485af02d6e2983cb90/asammdf-8.1.2-cp39-abi3-macosx_11_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "ac3cdfbe641ca89a13cb543fb0e7cef493a8f2958e87aa6a659d8fc2881335e2",
"md5": "5c4eee4ffdd36f781475e1a612e08e63",
"sha256": "0b17ea1affb58f85afb71aec60605881564ea3cd8bd4bcc9a33a6e8e5dbbe8b1"
},
"downloads": -1,
"filename": "asammdf-8.1.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl",
"has_sig": false,
"md5_digest": "5c4eee4ffdd36f781475e1a612e08e63",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 1144132,
"upload_time": "2025-02-26T07:37:23",
"upload_time_iso_8601": "2025-02-26T07:37:23.670378Z",
"url": "https://files.pythonhosted.org/packages/ac/3c/dfbe641ca89a13cb543fb0e7cef493a8f2958e87aa6a659d8fc2881335e2/asammdf-8.1.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "f6ce02bbb8edf1ec04c5f131570302f60a5ba6be86fd8cf6066f3fb4f14a43ac",
"md5": "d8b330afb8f4ce524538a0e9947409e0",
"sha256": "bec15b1b551f4d611c256f63b05689e50555a4e66c38806ac9e4809bf34d4706"
},
"downloads": -1,
"filename": "asammdf-8.1.2-cp39-abi3-win_amd64.whl",
"has_sig": false,
"md5_digest": "d8b330afb8f4ce524538a0e9947409e0",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 1144151,
"upload_time": "2025-02-26T07:37:27",
"upload_time_iso_8601": "2025-02-26T07:37:27.849279Z",
"url": "https://files.pythonhosted.org/packages/f6/ce/02bbb8edf1ec04c5f131570302f60a5ba6be86fd8cf6066f3fb4f14a43ac/asammdf-8.1.2-cp39-abi3-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "30a9e3d63d4a2ab292d0a61160190ba3d292088cc5fc76d3805d446978b08309",
"md5": "b0e98799a57592df1a34b5087cf50d0f",
"sha256": "abc4219ef0a27fc9f42e06c7d83cc9a4e0ee27806606e47284f5c0022b8155a2"
},
"downloads": -1,
"filename": "asammdf-8.1.2.tar.gz",
"has_sig": false,
"md5_digest": "b0e98799a57592df1a34b5087cf50d0f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 8559447,
"upload_time": "2025-02-26T07:37:45",
"upload_time_iso_8601": "2025-02-26T07:37:45.935773Z",
"url": "https://files.pythonhosted.org/packages/30/a9/e3d63d4a2ab292d0a61160190ba3d292088cc5fc76d3805d446978b08309/asammdf-8.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-26 07:37:45",
"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"
}