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.11-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75edf7008538d0b952ab08883bd5d0a26112e59f7014a8f17598da1b1c32ebb7 |
|
MD5 | d6d2fae1fe168fb824da9045fd75fb82 |
|
BLAKE2b-256 | a579d6d44a19a8392689e2c109b3fd30403e415aa958a5fdd62222302cfb876a |
Hashes for asammdf-7.3.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5e45965660a35b4c77aa9cd529bc939c9ce85dfea653faf0f32bbb5e1b6e6d5 |
|
MD5 | 56354d94e1a3d711efb95806d5eb3f95 |
|
BLAKE2b-256 | 0b3f7b825767701751b5ff05c71a6779eef50a4d8946fa7c80f057464411fa3a |
Hashes for asammdf-7.3.11-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23f159187835b86af8ddccc6c9ee141bc8c885ca42fe276f262598244d96a458 |
|
MD5 | 825a09e044b448e426f3460290b14dc7 |
|
BLAKE2b-256 | 10f1f2d5b8ba9266b2e501bbe9d41d12bfc55d649b71d8a4f9dd82467f6b4aa8 |
Hashes for asammdf-7.3.11-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c9ad9c82313529950ff6a27609dc1802aa16acac9bb1483b9f09429b0f6d753 |
|
MD5 | a95e1bb81accfbce7a94210483873139 |
|
BLAKE2b-256 | b35d90360ab45c67199be2d0351de42caaaa3ac3953e21b91821130883d7c6a4 |
Hashes for asammdf-7.3.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b621c0738cbca80ec7b3665abbd0e4019e08f81e9cca384422fa34cbc3acbe23 |
|
MD5 | d0139ba7a453da05a2da5f7a9c46b32a |
|
BLAKE2b-256 | cb3e43dece82cef65062887dcd2da642f0bdb254b1ca2e6009779c81f85eb53e |
Hashes for asammdf-7.3.11-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba9f08f4926c7802bea597a79f7927a229e520691ebfded419ff5c2d073ae2d9 |
|
MD5 | 37aad9d7e4f029dc612bc9ec926326ab |
|
BLAKE2b-256 | 10c859c151fe2d1b0b0859bb7c4ce45f1f3af1d39b59ab825ad42ddd8e8c9826 |
Hashes for asammdf-7.3.11-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4983338ca129b14f550cf55741fff2678ee81c2747661833b2336fa80fa08892 |
|
MD5 | 55b0cfb0da068e71cfaf58ea71f40e77 |
|
BLAKE2b-256 | 26ff5e8f7adb4343c79c0333e69d5cd5c762c1ad4342418953adaa90a64d69b7 |
Hashes for asammdf-7.3.11-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96b1e2abc6fe06beef34b33e7e0ee52daa45129c459cb29d6a1bd0176fc0a098 |
|
MD5 | 5d70916a8ea06ee027ae32e44df28d44 |
|
BLAKE2b-256 | 82e2dedbb0d43fdf36f13fd7ad5ae871ab66373f1c206dcd517a465c222d7cae |
Hashes for asammdf-7.3.11-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | caf2058aab3c66d56bd142ef001b4e3c93ff66025e754d393f81486abbde9839 |
|
MD5 | 06e971fcbc8781c67ea28dac5edeb793 |
|
BLAKE2b-256 | e923863c5b17730031f31ed25e78650093c005c1248a593560de31dbb29e2398 |
Hashes for asammdf-7.3.11-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56df050d2917f4f6d3189164ea03d0eb54a168af26690ffb7a77d2beea0755fb |
|
MD5 | f1d2a3dac12acfed6ed0a9f1376e37bd |
|
BLAKE2b-256 | 9b226c7240eed3dc676b25c273d3f50dd4563fb184253c63688dc6bf0e5b18bf |
Hashes for asammdf-7.3.11-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f4b9d5c76c613a7c629902cf1f55973b5ebb12b3ab95f6954950791faeb6cf5 |
|
MD5 | 214cdfbf7c8c304b5413352765f73f39 |
|
BLAKE2b-256 | e7b8f3b6442b064d7848233d9bbe6d808876302070b2457489652cbf4846a7f6 |
Hashes for asammdf-7.3.11-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5be29ac14045f21aada1e97741cdcb5b46f63213f78f5c353761a3b96e814cc7 |
|
MD5 | bd276de4fecb26e8162ed8b0bcdc850c |
|
BLAKE2b-256 | 264efe83c205a133b05609b4d1868f28e53e99e0110f7c16a033f1e009c63ee1 |