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.10-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03ee2d978e336105da31a700a07671837c24e23c8151dac94b9e415e24d77bad |
|
MD5 | 06b620eccecf9102e18ce4ee1116054e |
|
BLAKE2b-256 | 081c8a1d0bdee82ae1390f47c0f5db638c2a0e378ebe49b2810fc32cfd6dfbd0 |
Hashes for asammdf-7.3.10-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e93ed3c172f7e82a347cb4402b0715305308de873ce83a4eb55c2036839db52c |
|
MD5 | a8b7e36300d7552859be0178c5ecd809 |
|
BLAKE2b-256 | 7d6e49b143672e5045e4a94020a6705d32e600f5164b2e81a448c213e2213a6a |
Hashes for asammdf-7.3.10-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f66c169f3ffcf4c7e89327b6b7096ece3e95c8f11236ce424f91c8276c8507b |
|
MD5 | 5b44a1ec8b6c9bd683308ab3d144e0b0 |
|
BLAKE2b-256 | 6b3e9dbc65c9b1280548523c3a9e8794bdf5bdc6fd9331c2c7f6bcb1c8728726 |
Hashes for asammdf-7.3.10-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c716af415c8bb625dcfb426e835d34cde9cb01743749e0e8ea4498656a810cd4 |
|
MD5 | 4e8f63c0db369067ff9429c809559553 |
|
BLAKE2b-256 | 8bc95e664cbeaad6704d07bfdf27bc553393de6d94c5d2714f6d463a2a1467c8 |
Hashes for asammdf-7.3.10-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63de0cfdb3037153df593c83482796339b2b616ad54de2dbf58c1044cc803db5 |
|
MD5 | 9e1171e4a74e8e8a1cbce78c918c3b01 |
|
BLAKE2b-256 | 0baf289042f0e32d010be7a6a0ec87b01302e6edeffcc82e8822d88f63d81a84 |
Hashes for asammdf-7.3.10-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03df1fb922f5ccfb78b3bd41ea069d98962fbf1a07c874e0c0f20ec613374db9 |
|
MD5 | 526635b0f80819b9e60e009724d66ed2 |
|
BLAKE2b-256 | 1301c44f6a09991a37098f5a594a51cd5a6d6fbf34590367d685b8573041a887 |
Hashes for asammdf-7.3.10-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52553e86f569841d36c3fab56421d2e917bd59cc2be4c2343b8797a596490dd8 |
|
MD5 | c67e05ed2e9735c110eb0856d478e9b2 |
|
BLAKE2b-256 | e66039fc2bddb20a9614e3a312699ebe5735192e0f00822c26b20e5db178ba70 |
Hashes for asammdf-7.3.10-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b85bf0147733148e3db59f6b1cffe60afe82b097fee2e9dc858d33f554f3586 |
|
MD5 | 68dd430bdd7ae9d19bec7da39122ece6 |
|
BLAKE2b-256 | 9de0fd2debdf933505eeceb011e97c648c963a68e80d3575139240efd53e0927 |
Hashes for asammdf-7.3.10-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d6b3aeff112913b162b558c00ea12c5e1a57a43226c4644b33a7ba2d8b5fee9 |
|
MD5 | 578b4b11f7dbca3093dbd48e99e43e12 |
|
BLAKE2b-256 | 993b507346fd6bb6c37092a40774a7f026b82c2e84da0582dc0136ed966941af |
Hashes for asammdf-7.3.10-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0954f90943ffb277d860a219386ee5da4c7a651ee42ef75d25d20d3b88f1f31c |
|
MD5 | 18f2d668c0ed92ecb4f60372d97ccac9 |
|
BLAKE2b-256 | 8eb1c07857f1120dba30371d96831b1c27fdf61e05ebde1a3525f4a8cfe83c13 |
Hashes for asammdf-7.3.10-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cefae1f13803c917ab3923ff2ede298db516e8fc4aa3e18cb6838df50e799e6b |
|
MD5 | f7ffe6252b8b7b7258aea52c0ce017a1 |
|
BLAKE2b-256 | 25d5d8d7c1b9a048ad42f3cf5ff1859349d989f8f44cf918099588271545ad9f |
Hashes for asammdf-7.3.10-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6745436790613d97581a64632ea46ce2c6a09fa77cc95f835c03213ca6c15301 |
|
MD5 | fd033f450b775bd963787fe748b872eb |
|
BLAKE2b-256 | 733eef42249d9611929a886f0b8840b0757d30f6d4e8c1f1377b7fb21e0d727e |