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 Distributions
Built Distributions
Hashes for asammdf-6.3.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b83e5b384f05998984860efe639b094cf7009d6bb67e8d3f23fa0ef6343617a |
|
MD5 | 0a586386100eee2734ca6724fbdc3d9d |
|
BLAKE2b-256 | 43b36d63a63d53d0e4f30e97cd7b4888c091912280f1cd320670323d58461b7f |
Hashes for asammdf-6.3.0-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | afd99c952cc73ddcc21d046ee502ced4779dd01b3aca7bfecbfac138bae5d842 |
|
MD5 | 0b76a45ad780f892a8173251ee15bea8 |
|
BLAKE2b-256 | 7dbd3b221a0b172f8971a7210a41c7396e3ee8c899a11c9882accfa4336d88e9 |
Hashes for asammdf-6.3.0-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0419ff340b7e561826938530488c9cd2de4bb15109e71a2fafc06cbef2f9e36 |
|
MD5 | b5083f6ea5317d9ce996c23dd75ec079 |
|
BLAKE2b-256 | b33ee2231a0156b7966f3d146e27a8d738af2ecf718d9a929c042a1964902137 |
Hashes for asammdf-6.3.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51958563419382068e7f2ccb93c548a30274c82959943c67f8f29dfb2dbf747a |
|
MD5 | 631fb39d2f196e1a41a099d693ae7860 |
|
BLAKE2b-256 | 25a67b2940ee936772699c06de04d411d59dc255da251c6c04df094c7ebce20a |
Hashes for asammdf-6.3.0-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 250e1dca71f67f29f5ba3808446ed1f3cf2037c41ba2fb21ed18de1d4bd91003 |
|
MD5 | 91d90d011aab5c73d9ef18ac0367e247 |
|
BLAKE2b-256 | 7610da965506c6485fae8e1653b7425f20e5ccafdd7d5481eccbcae579f89f0d |
Hashes for asammdf-6.3.0-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2bee5e582193d4cdb83da06523233c8191e905a71bf20637ca527979e28348c8 |
|
MD5 | 43c22f5a14ebe543e5e2a3ea3728b60d |
|
BLAKE2b-256 | 1a1e8fd29202aebefbf8543cd7e7285805bf1a33e1ea3e68af6f4ab09465ab5c |
Hashes for asammdf-6.3.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69c13bfa3b2911b3d4d5b51e0d938f9def5286b2ada33f3ff9a1b93130b31bcd |
|
MD5 | 7b993e5630f531946feb6ff355f233cc |
|
BLAKE2b-256 | 6fa74a9bd86187f51e1e26945a91dc4b2718936d59bf35ebb1bf60c4973b4210 |
Hashes for asammdf-6.3.0-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 603a223c55b07a4b76238e326867015c132f8ad99083787452e59da911a8e933 |
|
MD5 | a2b721b41b09e090b48733cc7834c505 |
|
BLAKE2b-256 | c3f49b80df6aedd86a8cbe1eb7f2f681c703b128d9522f26cd69bb6618482348 |
Hashes for asammdf-6.3.0-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29564f33c42b1f56501119e91b5924c20b15460e49d0bd5a024ba493534f49d2 |
|
MD5 | d15be7dac78e4ef23df4baaca308022e |
|
BLAKE2b-256 | 874bd0f90149baae5e68adac002b51169339d0bb87c0b925643c48aede401cf1 |
Hashes for asammdf-6.3.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d1c2ce5b0d8623343a57849de5c0b71c6fcdc66b82ffce04f54304bd9873e26 |
|
MD5 | 426fe153c95aaab425e518269ebf878a |
|
BLAKE2b-256 | 8a8a7c434c0ab9a14671c79c2092707408510701cac468bb6fb02afe22f70934 |
Hashes for asammdf-6.3.0-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 579a21be55517d0b1d4384a59a6c52349d16ea6ca138d44001bc1789bed9aaee |
|
MD5 | 1c6aa5dad647b3d89e673e74f9147fa7 |
|
BLAKE2b-256 | 73c0332df6f82517aeebb316e64b3e0c96bc66df0b5c1508d42c2ea57586b9fb |
Hashes for asammdf-6.3.0-cp36-cp36m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1a5584212e395c4bea4a7f9cf0b3ab05dae09eb36f7f3c4fb644364ce49e30a |
|
MD5 | 16d35e67da7c99c103dfb264539e6316 |
|
BLAKE2b-256 | a901bfb200f76c39187d06d3c68f85dcf2e002fac916b16c865ebc8905e1f9bd |