ASAM MDF measurement data file parser
Project description
asammdf is a fast parser and editor for ASAM (Associtation for Standardisation 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.6 (for Python 2.7, 3.4 and 3.5 see the 4.x.y releases)
Status
! | Travis CI | Appveyor | CoverAlls | Codacy | ReadTheDocs |
---|---|---|---|---|---|
master |
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 (v4, v5 and 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
- experiemental 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 transfered 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 defaukt 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:
- Julien Grave JulienGrv
- Jed Frey jed-frey
- Mihai yahym
- Jack Weinstein jackjweinstein
- Isuru Fernando isuruf
- Felix Kohlgrüber fkohlgrueber
- Stanislav Frolov stanifrolov
- Thomas Kastl kasuteru
- venden venden
- Marat K. kopytjuk
- freakatzz freakatzz
- Martin Falch MartinF
- dxpke dxpke
- Nick James driftregion
- tobiasandorfer tobiasandorfer
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 pacakge 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 peformance
optional dependencies needed for exports
- h5py : for HDF5 export
- scipy : for Matlab v4 and v5 .mat export
- hdf5storage : for Matlab v7.3 .mat export
- fastparquet : for parquet export
other optional dependencies
- PyQt5 : 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
- pyqtlet : for GPS window
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-6.3.2-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58b8823d5adb5f783ecc5b886e83fc48f7261e562188d12d4c2a5b257e38bfa0 |
|
MD5 | dfecc896f5b9712fe6e621a751a34c2c |
|
BLAKE2b-256 | 91f411a3deb97b6633388f3fa2542a13043e324380a2915928650d8ab5adf5cd |
Hashes for asammdf-6.3.2-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6bb4b8027da89a29eb131ef87d2b3e7d24515f5ff028627fd1d8f60112ff579f |
|
MD5 | 6e6c6154a36698fd5d4ac9732f0bf5eb |
|
BLAKE2b-256 | e23895a1a3bec81677cd1ec24dff9155786cbacdead1f414b62dbd071b487f43 |
Hashes for asammdf-6.3.2-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf4770b4a47245ba88284abd7d816a70d63c0822f090fbf87d81cc10a8640cb6 |
|
MD5 | 25366d0b616958af5225fadda24bfa16 |
|
BLAKE2b-256 | c09ab9a3c83bfe080c028ffd9771f8eeeb59630ecfa2c1b866ecb12fe9e5ad64 |
Hashes for asammdf-6.3.2-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6bfe2dea40312df6645e3c2d7142fa4338c0fe24b90f6d67bb92537ebfab20fe |
|
MD5 | e66a603f2c397069790c3720f75cc92e |
|
BLAKE2b-256 | 65f67328cb3ef1ee61b251ab2ae853de99b9286038b5063064c70696aeb3d610 |
Hashes for asammdf-6.3.2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9179dfeb2e848690df970922e734953b953a17a08de4b07a2d9332747e3877c8 |
|
MD5 | b81230d2e65fc51c3559b47120d75199 |
|
BLAKE2b-256 | 0df89c1a3221039f724ed0cbf673f4a03673e2cc0fda4ae8e9ff074205df3ac5 |
Hashes for asammdf-6.3.2-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3de44daa0a4f3ed4e30b03ed1ce786a825efdf8a80ccdcad2faf0ca43378426 |
|
MD5 | 203f7b29e43eb0b65aa15dd91d59714c |
|
BLAKE2b-256 | abfed27082428a26229ca67b325e5e0a8237b1af2c6c550357c68c54bf91cc33 |
Hashes for asammdf-6.3.2-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b69315f184dd2d1e6854a783dcc67552778aa862dfa99c5440b7f07e97dba888 |
|
MD5 | 4a4ccb658bd16f505981847bfb0671a4 |
|
BLAKE2b-256 | d886c5c3cf6e07285f105f767d8beb145a878bcdd1766c37d18457a1c2a43426 |
Hashes for asammdf-6.3.2-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88b1a8aa9cebb1e26c1cb70710baf7e5a2f0e267f62617edad668ea6b1f1fcb2 |
|
MD5 | 660d174249f899c808e94427211569ab |
|
BLAKE2b-256 | 35e54037459304a6a21e17d513d7b3ae92541fd98fdda97437aa3fe9f2073940 |
Hashes for asammdf-6.3.2-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a422419819b695f40478d01727badb48e72c89a636d02de4aeed4aca30a05920 |
|
MD5 | 944a8713710026eb0c6658e7e0b8a8bd |
|
BLAKE2b-256 | 02d6d83a8c696c5d2980bc698d24e186604ab4eac69289a4a1beebd46a5ab96e |
Hashes for asammdf-6.3.2-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b86d07a785467b70006d8566f912d4e42a4342e4454c393fca801f1456545c6 |
|
MD5 | 5c9da4ca084c9c63814657318da0852e |
|
BLAKE2b-256 | 741a6a83ffaae3cc9380a57731d6750c54da306704bc655218cf8aba846aeccf |
Hashes for asammdf-6.3.2-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa7623f5058d3696a8cb5572b74c54f87fc515b5d906cd5d6290d71bcf5ed490 |
|
MD5 | 5fec8ee521052abdbe5d1e79b3b8a5e5 |
|
BLAKE2b-256 | 045749660da5cc19a47334fc671d82fd8e7f328ae1a179ee98cde5064f302bc9 |
Hashes for asammdf-6.3.2-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7dc1fc30c80c2c08c397a1ac3a2918f5e46699809b92ae7d3ec6b632854d9b9 |
|
MD5 | 95705fdb0a005fe97769514849e56bbd |
|
BLAKE2b-256 | f1dd111a07c53911117fd8dc6ffef4eb44d6d6f326f23caed4d5531ae601bfbc |
Hashes for asammdf-6.3.2-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 249d8ea81305e490bef037f8ab4901efdf5cf9dd43c38bc838bb9fcaf69a979b |
|
MD5 | eef93aee9a0a69c1e5082de9b36a6789 |
|
BLAKE2b-256 | 407edf71d360af107e4ef2587fd7fe7b21a33aaf5def288a114e14e1601baccf |
Hashes for asammdf-6.3.2-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27cc2268ccecb9ef7cad9da9195b8669b4253e259252ea5d0e339ecf05a401be |
|
MD5 | f2c127c4346a9188bf342b7375a31768 |
|
BLAKE2b-256 | cd569053f7e8627e1312c1f6fc5d82ef8ffd9ceb1b2e2dfbdbe82eaf3df6e2b1 |
Hashes for asammdf-6.3.2-cp36-cp36m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 813b644827f9aa2c7e67f5d04730b5093239c33e830af4c2b3d216c6140c540c |
|
MD5 | e349147920a2a83deede3417b67dab99 |
|
BLAKE2b-256 | bac45b44890998d3a06e1c4bfb97e0bcbadf189f7a469044dc0c54decb504f75 |
Hashes for asammdf-6.3.2-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5c99dbcf4c915bfe0aa2021f9aa620f7adad89e87f564638d99a74f26df4109 |
|
MD5 | b331ec9e7e415126bdb4b5163f220b85 |
|
BLAKE2b-256 | 71752129c9863f63118bd56de343d1776dd48d59a42ccf3ad0b1a92330ddc9d4 |