ASAM MDF measurement data file parser
Project description
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.8
Status
Continuous Integration | Coveralls | Codacy | ReadTheDocs |
---|---|---|---|
PyPI | conda-forge |
---|---|
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
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/log-file-tools/asammdf-api/
Documentation
http://asammdf.readthedocs.io/en/master
And a nicely written tutorial on the CSS Electronics site
Contributing & Support
Please have a look over the contributing guidelines
If you enjoy this library please consider making a donation to the numpy project or to danielhrisca using liberapay <a href="https://liberapay.com/danielhrisca/donate"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a>
Contributors
Thanks to all who contributed with commits to asammdf:
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
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
- fastparquet : 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
- 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for asammdf-7.3.14-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7e2a4e1a8fa35a5bbaff999f8f3199085ad9884e29c684b5f6239901393f1f4 |
|
MD5 | a00df59124af9e0ddb929e12928264ce |
|
BLAKE2b-256 | c6877a543bedf4b175d0af49de1a6d467dd874c8e2ff4bc76af65d11b1285d76 |
Hashes for asammdf-7.3.14-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e7e565a2bfaed82ef978d31f005b56686a0418bd4024d02854f40e1186cc5bf |
|
MD5 | c43faedd46385e12774803da27b72f6e |
|
BLAKE2b-256 | 4bbaf9e547dccac875888caab010967f45314fd266c764803724aad4f6fc7883 |
Hashes for asammdf-7.3.14-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b447f575f1a9bc7382e3b1df9d35d24a2830d9032ec59c21d309532834e73f54 |
|
MD5 | 94908d52763c562cc0cdcfb6f3d789d0 |
|
BLAKE2b-256 | 865008546b84b18f5e4167f185eed21107afa647ebe15266863cca54ded31934 |
Hashes for asammdf-7.3.14-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e3dedba63e9ec42bec7267f746d5c0ccde707cbbd3bf9eeb88a4229df23a214 |
|
MD5 | 1cf40974189097007dfe7e79e531a9b1 |
|
BLAKE2b-256 | f12841fc658039911f88802681b3f16a86e31c1381443e9136bde8cc65d75701 |
Hashes for asammdf-7.3.14-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36fa5f5ba84fd2483902f13a209c66b3b464812a8d63cea5545b6391c84c640c |
|
MD5 | f694572bbc18722bd7d732cfb2b87775 |
|
BLAKE2b-256 | a4903f105ca2209b7b655025a94535ff2f80d7b03f37491895f5cffaabc2494b |
Hashes for asammdf-7.3.14-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc7f3dc708449ef96bd75e6ff4d0d3a256f119e0de87f0c1cfd351486093b7a4 |
|
MD5 | 02bd668d4fb4c65c00eef2acc5502cd0 |
|
BLAKE2b-256 | 330a513c786350e562474ec1b775104037352724dadd7ed8836ba9622029bc48 |
Hashes for asammdf-7.3.14-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91bca39d3ad486eb5ddbba4d3f499ded0a507639a0a698e96f5825b173c225e7 |
|
MD5 | 4df84336faada081fbc1d3f3810edc8c |
|
BLAKE2b-256 | b7c415ddca4be580f2bfd33f0e23ccb7f02ffe5fd53d910a3d24342749a0cc1f |
Hashes for asammdf-7.3.14-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c74356484156a7be4f17d2121f8616c25e0045a6e1e9209ca5df183a5ae17e13 |
|
MD5 | 0bf4a5cc837083b95162fe77bbba8945 |
|
BLAKE2b-256 | f09c6c1f69c39befcbf02dc075b57001425f6854b0ff61d23d818f0b6e3899f0 |
Hashes for asammdf-7.3.14-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a770e722f68d7d418721881f84658d5d37ee6d6e31dcc3ab316724cf46ec7b6e |
|
MD5 | 9d20f203d1b29ec6706e4201c3d586e7 |
|
BLAKE2b-256 | 9bd55bcd95b49df08df9e065c28a709a6f0880bf5d4211835c51fb417b726beb |
Hashes for asammdf-7.3.14-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c8a7ad24744675769fd0b85af3b98bd12a4722eeca0bc23a9cf679213df3477 |
|
MD5 | 2fdeb8c846465c31dd35f89c7deafd5d |
|
BLAKE2b-256 | 8ce9bfaf74c8764e3555300c8376fce98fd15df5c9bdc9ff47cca0ada942e773 |
Hashes for asammdf-7.3.14-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7aaa1adfb400ecd73683b1a98dd771361e0fa542f0b5d0373fea829c85d7d175 |
|
MD5 | a5b62d274b46f576628f6ac87e325487 |
|
BLAKE2b-256 | 654e0424f0091adcc4c2f717320afd6d27fcc6e07dcae6521c3288d38f23d24d |
Hashes for asammdf-7.3.14-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bdd2577a534e04227b6d7404df6205ca8a94660e5b8eb3a504b5b340071e8080 |
|
MD5 | 9968a65989c727b78e9eb0258fffa5fc |
|
BLAKE2b-256 | a51a0439df5802eeaa00b094f1f85116a0e8df2477a1dd4e694487bf514199d7 |