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.17-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 803a6d2c5fa791658612330dbdc1d7254a6fc951ad3d4034ba75e37f4618001d |
|
MD5 | 29fa8f5bea8208de75a093d9f0ee6ab1 |
|
BLAKE2b-256 | 8b198236033aacd17b176185b7426f28753213a9e7dea9dd21bfed40b65ebf0e |
Hashes for asammdf-7.3.17-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f9cd3e812ee5d241292541581886d5a0d63fe79b7d618155ce3d5038114208a |
|
MD5 | eb3bc82a71fd81c43e8e7f7160afc570 |
|
BLAKE2b-256 | d967742c6c0ec0080c2045512658b7de3a75c38a093e4da3fd01a0f88c912c64 |
Hashes for asammdf-7.3.17-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9ab07559747b949c52e4cbc474ac970f26831aa3235d1b08a4a1f5a5610acac |
|
MD5 | bc6ecb9cb684d8346beb2b21695857fc |
|
BLAKE2b-256 | 755cfd1d73876162d8de01eb2062fb689ee01b825b22124837d40399212e4fc3 |
Hashes for asammdf-7.3.17-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96c8493b472c67729bd24e6408933dcf8c9c093272393e82c06bc22393af4f03 |
|
MD5 | f9dff2ba0434ebd7acda562ade01b997 |
|
BLAKE2b-256 | 0e4749fecf5724d581b16f42a0121ada43c657cdee5b0996f514d57a969f90a6 |
Hashes for asammdf-7.3.17-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68c28687c62507136638c7c3f89db23ea4dcb7db8ef0e682c4b74998d63d8caa |
|
MD5 | b9a695de5edd9a56914cc201a9fb19dd |
|
BLAKE2b-256 | f712a270d6a64b5cb1af23e1a61ef71ab45ab0f27f439cb281f7c5d3e419cf90 |
Hashes for asammdf-7.3.17-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 372f3fe53d1d498577784c3eb4db232095f041f79669f02179a696c3e9953c8d |
|
MD5 | 119c827804c4089027215f67c19277d1 |
|
BLAKE2b-256 | 1aad0cf669c841c9fcf51786a053641fe1bf5e4e05e17ffb4423a8bc628d08c3 |
Hashes for asammdf-7.3.17-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2d1a78198ac680c513ce5e09c426c4c26e6bdb60bec3e6b9e0dfe2648e2d805 |
|
MD5 | 9909ed4856576d056af0cb16c70de9b3 |
|
BLAKE2b-256 | 47537a0f96c307336e0eac274775d676ac5b2f79eecbefa06f007791bd1801cf |
Hashes for asammdf-7.3.17-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5d2ec5ce3958712a9b46d90a85954680d40e830fee9d31442572d4758845019 |
|
MD5 | f45c37b007423f952f97acd33df892c0 |
|
BLAKE2b-256 | 13e9eae3dbbcd11609421063c8dc4176c04e4603f9c49d7228e1b898cb7f7c6f |
Hashes for asammdf-7.3.17-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec26abaccded274c11f2fbe75d8af052902b7db9f39a244d89983527f75dc365 |
|
MD5 | 0daee801ca98bdf09a51971bf78c86f5 |
|
BLAKE2b-256 | 5247a6bf6b3b23f9738b810ed953f7a8bb8f209599e2d3a63fc6d03956b0eb8d |
Hashes for asammdf-7.3.17-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a72f87642882e3ffb45642c1379e6b65f31fbc2f36841506725e881e2e9f2098 |
|
MD5 | 74ea1f815536043c8fda160f079f3983 |
|
BLAKE2b-256 | 08459aa8a3abb5bdb93aa1b3f881218e0baab58615b4da23ba7cecca7076cd3d |
Hashes for asammdf-7.3.17-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 379bbe1f145a89bb7067e50bdbb5814a47f87b85113785b415b5f6b232d840e7 |
|
MD5 | 41a638a2fee1694c147a7c954dd746d9 |
|
BLAKE2b-256 | f1cd070a7932ce00b4c6040ddb58b3a7d96e56f32f66a7ce9eb23499f5fb08bf |
Hashes for asammdf-7.3.17-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1cda3fde93da80403853e7f880c6fdbd772f99a54abd125c2050d6e8a5df68d |
|
MD5 | 5ba03797153ebd3ada25a083dd7b7a8e |
|
BLAKE2b-256 | 8cfbe5cc20c389c9545d5b86cf30f383773ca84bd47f60b255d970859602affa |