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.9-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f8ea159c56c5d40b3c5508b7f009b10bae9248ad831864190f110182f8d9052 |
|
MD5 | b8691b1e0bf768b4c9681cb5a79a305b |
|
BLAKE2b-256 | e507c6c2efd0fc06d2660a3b194e02e15a412be848682eca7aa5f9793c4c1ca0 |
Hashes for asammdf-7.3.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57935b69ff5724fe63a3783f1a5ea23dcf305aeff12f21217ea86eb82944ef09 |
|
MD5 | 15c023e7d27e400084c9246a48cb1799 |
|
BLAKE2b-256 | a78e70745ed70ee5adf74493893749d777d5860361c16fce6265f34d91ce5f71 |
Hashes for asammdf-7.3.9-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6a79e9663d61073823c6e57e5815bd94e4262da76d19eadc8f80e3fee60e204 |
|
MD5 | d9da654b2075a3c11eac5c6efb735e4a |
|
BLAKE2b-256 | 374c0e39ad9bca061edd68d657b890ce70f457b21359c5fb222b149440379a85 |
Hashes for asammdf-7.3.9-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69596e863bca3ea63352424ac91ebdccda6a28f009566a05b3d931fcbcb4363a |
|
MD5 | 904493f1aa844517c76a77211337d7e8 |
|
BLAKE2b-256 | 5850d1c3f50e99108c72985807642f5a5fd2a93e22a5070b81e100d1733ea3c6 |
Hashes for asammdf-7.3.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62074c18cb2842c770bce7bf79b13bfeb47837cf3554f65aa91c6407ac4dd037 |
|
MD5 | 8537bb79625eb90ebb715bb2150949a9 |
|
BLAKE2b-256 | 87738ca102b34746a20c851fafb42b4d6212ea873cc8e977120badc3400c50f8 |
Hashes for asammdf-7.3.9-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56a61924a428399abf61446f8557f7b6714eb808da5eb95f5423d12bbbadd3f6 |
|
MD5 | 95b8ae8f3a70ee633932b6fd5840ed04 |
|
BLAKE2b-256 | 587159069e6cdad642d398239248e6b1bb041b5b6bb5999a4961d46f7693fc9e |
Hashes for asammdf-7.3.9-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8640e66f29f1ea05f92368a61c331d5a61cd6444c793911023752815e5fec09a |
|
MD5 | a58aed8d91f83277fa3c829df911cc1f |
|
BLAKE2b-256 | 3f5adacf478bed8d2946c083fb3324247500931ba366fc7bf9de54064918067c |
Hashes for asammdf-7.3.9-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 965aa8baaa988600386fd672b4d3aff1c3cdb1035d74c3cf8717cbec391f1c99 |
|
MD5 | 7335cc79ad5b41c033e65e8a114c90d5 |
|
BLAKE2b-256 | 61fb1e320e147d60224a6064710311711010904eff7db40220ac491a787c722c |
Hashes for asammdf-7.3.9-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a0bcbe7867d542ecb587068e4f03763b1a7500e9597195c63bd40fc88c32ffa |
|
MD5 | fec3c0a47bb9b8db2713c52722d9dae3 |
|
BLAKE2b-256 | d9fbbd5c4c4aa131187af7bc02138743b6719f0bb38a0a2070f3f00136b7948e |
Hashes for asammdf-7.3.9-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 476391ff5de0f08261189ed4e49a6752fb18ac46384b7b71e56c190d28e36aff |
|
MD5 | 2603eeacffca0ee33b06024f95393e23 |
|
BLAKE2b-256 | fcb80dc347e810368a5f0786315b673f2610efd2939a3d10155da6576ba9e0a3 |
Hashes for asammdf-7.3.9-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab245a6784f6882aab6fd6cab12d39689327bb3d229fb5d77f55cf1832f77b16 |
|
MD5 | b5b65a026868b0d19ba5442473dcdc75 |
|
BLAKE2b-256 | 770c8aadb3c6b7a6e1f7312429e831bd8476360d5daaf85489bb96f3b463868d |
Hashes for asammdf-7.3.9-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e102585b91b6d4a6c43464d08c9229f3cb7c8077245f799b078e4b1f5c864d97 |
|
MD5 | db09f1a221f2ac737ba8b0e2e0379f37 |
|
BLAKE2b-256 | 265db43e12ea918fc1745e3d2023141fdc392b390a8a82faf499c3c68fdb92e3 |