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.4.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95bd13e1be02ceb89c9495c447819479111e0bb7c7f62bbbb3535151680964bb |
|
MD5 | 16a017c35b40ccdf312b7740efc0681b |
|
BLAKE2b-256 | 5b71823e924fefdcf166f2f019d60319d8945d5e6adf97dbe4b790db7d6a99dc |
Hashes for asammdf-6.4.0-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5115406781537c8ee86ec62a494c018852584587ceec822eafa1e42ca29bd0ff |
|
MD5 | c6a069a7b923af32a780a540523dcfb1 |
|
BLAKE2b-256 | d92524e592526f51e9af976c84717d2cad0953883e5ef1dfab2f2c9d8708cc64 |
Hashes for asammdf-6.4.0-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9d647578f2b13f45eac4558ac4c94b5495cc908da99fcb13e30b72b0c719d1c |
|
MD5 | 54c08be767d6c8d461b664c7899d2bbd |
|
BLAKE2b-256 | c3569bc9fbc2ad783b52640cd7a9b3336e5912f571b15d75f1e20a4bf45aca50 |
Hashes for asammdf-6.4.0-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5b05c87cf13c656b282aa1b959c7eb489682d0cdb8d99289d447f846acc9407 |
|
MD5 | 3bdab55c2c7bdf78c6f1051fc0ad2ce2 |
|
BLAKE2b-256 | e49988f2dcef8e54dbcea7e3591de82ec05b716ddef832e034551826f47a2803 |
Hashes for asammdf-6.4.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c3de9885652d735dd7dced3d21f5dd691f5fba1e7d597771d6879c93d0c3f8e |
|
MD5 | 5348ca1e9af74fcdcccb38850291bd6d |
|
BLAKE2b-256 | 1ae2aa806250ff7409e9f76b83d1280d21c4825d20ad30f47e9fc3321cd6223e |
Hashes for asammdf-6.4.0-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20cfed11b4bc54c83704dbc3b4d50973dbea8ca2fe0d29325660541402875eea |
|
MD5 | 3c585a410d56c7aacea2a304548901d5 |
|
BLAKE2b-256 | 5a250ec7dac18f478d0632bbbfffca3b6973632a208a7d3cdc6fb1631e9757a5 |
Hashes for asammdf-6.4.0-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1e5c658b68461e431ea34e637f281ec4af9155ec1519e4795b56f9b0d1a348c |
|
MD5 | 2963e31d8d33241469829894d4785b53 |
|
BLAKE2b-256 | 57c2bf862640a00909a32979b33c7146e4585f20c7d9a20587e36755fb96498f |
Hashes for asammdf-6.4.0-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7e341792d5fc24e2a22e89b91ef1593d98ffc403b84433dc2a3d26a779e30f1 |
|
MD5 | 5d5161c3bc258cf95c3f52e56b1c7126 |
|
BLAKE2b-256 | 6737c075c33c60bac47012b45bd715119b90033dad53b7c3f86ab26846603a6a |
Hashes for asammdf-6.4.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04a98d02a12ac9e30754abd2d5235c8b56ea4d3027b2fa8f72ed27585d4dd66c |
|
MD5 | 82c31b49bb284c9907c42e693791515d |
|
BLAKE2b-256 | c48c8ae58a2c2080c828bbb33738279a363307582170b8a3e95783d0add4fd7f |
Hashes for asammdf-6.4.0-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94785b4555188f3a4c3acff891b6ad17016245ab7c6496d7745c1142887e89b9 |
|
MD5 | 8ea1b2403546e3933656d3a9ca48233f |
|
BLAKE2b-256 | 7a64dd75838bde16986d4fd3c5a2c96d7fcf6627f8a7ff676ffd6bfb4c384a4f |
Hashes for asammdf-6.4.0-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e348dc0e076eff1f8db2a0f684ef440d6eff8ef86e1a935c623af5d9bfb4f4df |
|
MD5 | 4a65798ef9bf770729a33f03f181fa0e |
|
BLAKE2b-256 | cb0f0f309cae233ccc1cbd96661d4595f15ed4aed6f18181cf2776b9efdc339a |
Hashes for asammdf-6.4.0-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89812f2da605b57d4c95d98ff41cfe272b0c5ed110a313978b2cb580bf778482 |
|
MD5 | 5629bd0232d4055139a83e0131701b42 |
|
BLAKE2b-256 | 4868b293ef3054e3b98cda19c04a93860db65380b1d526f5acd12334e47680ac |
Hashes for asammdf-6.4.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f066ec7b24cbd22c75bd79009f930aabb2b82ec0d4c0b7407a03220533a04764 |
|
MD5 | 09afc4ed5731bab766b938f14061bdb7 |
|
BLAKE2b-256 | 253106fde126474e88e7bef944c04280c0e6d3672e7c6867c53b9f848eb3f48b |
Hashes for asammdf-6.4.0-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 078195dfa30612960e6b26bb97ac00b4788c7d12457a628ac02a9a8745e872c3 |
|
MD5 | c99a130a7ad28f03f0d78dc41a1cc174 |
|
BLAKE2b-256 | 301492c583460fe9b14ec42f0b8554da2548f4c69686606a6d6aeb8b6b187f6b |
Hashes for asammdf-6.4.0-cp36-cp36m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0464d29cf328e1ee523fdec2ae6c983a2a5ebc16788a5acf3a35c0a7b802e640 |
|
MD5 | 4efd7ba4d70abcb74d3730f1d553f539 |
|
BLAKE2b-256 | 9330277670a24a64b78fadab5b8e8009870a689a41e9d98b7365cfd2d494c753 |
Hashes for asammdf-6.4.0-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 523ded46b983980ab4f81aa2f82d31384a39f511017df6de85b42fbb615a73ed |
|
MD5 | 8b7d82b778abd99106fb2051e76df23a |
|
BLAKE2b-256 | b759a4df93c0f17cd2cdc3ea7665125c3ffbe9d51f118bfc35e759979288450e |