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.7-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73751c6bce54aac27749748c0a15d8133cab4024e8b453ebb1503e626f3d2a2c |
|
MD5 | b784765ef4bba759f5276fd8e075e5d6 |
|
BLAKE2b-256 | 6769d78a7e9f488c3ebeb31101b887c691f436b9b802df5f85e58c05b2e5a9a2 |
Hashes for asammdf-7.3.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7cd679da564f3710cebfe855df17bde0281a70008dc2001ed07ccc744ebdf380 |
|
MD5 | 71b178ff23c128a368cdcf8736f65b2f |
|
BLAKE2b-256 | da82a402ef46093e8c924c572c7bdab5b22efd2e84f0d3cfd79b3df4b8830eba |
Hashes for asammdf-7.3.7-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bdc5cc1178b87fb65ba63047a71056eb7913432b6b734c7f7efb3f30ab660ada |
|
MD5 | 3a8a0b13fa4f0ff1e078cd7077a1e749 |
|
BLAKE2b-256 | 04875db7644496a108ef7d1fc22df46b8f2fbf4268b33e446678db29067b7e71 |
Hashes for asammdf-7.3.7-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4bf3bb07790712abd894173709a2e6211b194eddd568728bc2a52b5c8026feb6 |
|
MD5 | d8da69222e031e01f88fe8446e347064 |
|
BLAKE2b-256 | 15bd03431cd7bb30d07c341c911b76be7bd0e26c68713cc3cc7a0e552847a8f9 |
Hashes for asammdf-7.3.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec8aa2a223d3c1c67ab7859c58cba703589a1993974eb4c9b509fb49b32a481a |
|
MD5 | 24e3b74c55fee054c93cd4d48a876a00 |
|
BLAKE2b-256 | fcc88fc9e4409d6e23cb61f7b50354375db449ba1d0121d3c68f43d44ae113c9 |
Hashes for asammdf-7.3.7-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b77ce57d1d94f21a0e7c30b84c13c64463973f4c4c1142446e5c50991255e3d |
|
MD5 | b40bb4a79f975457349638830816e5a5 |
|
BLAKE2b-256 | 98a1913d73e65a8497b588d7d694ce772fcb573dff3314275d9a76ab123da1e4 |
Hashes for asammdf-7.3.7-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98e558822773d95e93931a195b85830f0104569582318251711a04af5f96dde5 |
|
MD5 | b7cf402c3efac1cb68d711cf84f964dd |
|
BLAKE2b-256 | a5657463fe835e363ef57ded9b9c85fa8bfb83bb125fc0bf5de99847616bfaa4 |
Hashes for asammdf-7.3.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | df70f01f3be8ebc94b83f9a722524cd26a86b81e04f14576ea14fbf766d5804f |
|
MD5 | e3102b713c3a9e1b6419d8b7e3c006f1 |
|
BLAKE2b-256 | 7e91f5d333e15aa5981a683d0ebe00eb757409fcad2a3518cac9cc540e1dc2a0 |
Hashes for asammdf-7.3.7-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca4166eb7c6d3ba59c76dfc672b3a94e82e94530d5f90c60e3fa06dd461293ce |
|
MD5 | 8f6ecba3891d4466bc7c57f9b3002f64 |
|
BLAKE2b-256 | 5832683c7ce536ce8a8fe96f5a38a1f0ad7d2e90e80a28ab11c25176abeb3bd1 |
Hashes for asammdf-7.3.7-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84d29f96a71edca8126f5938a106c9255bbcf2f0e4f06d2bc90cb805a33c553f |
|
MD5 | d22964917b2e03a5d0cbdd95ca2156a0 |
|
BLAKE2b-256 | 8109c179e693d1da1f1d7494bacdd0fc34586f844e07330fbab9c50044063103 |
Hashes for asammdf-7.3.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de3209b9e5fae8db2f5b21edbae0e29db390a6b0c4a9f06f924fc7a9d7c29505 |
|
MD5 | a82d67eb43f714baff836ed71f30ace5 |
|
BLAKE2b-256 | 97eb8a42aece9faaa33110fababc6fe289df7ac7dc0f5f9bbe39dae5ba26f441 |
Hashes for asammdf-7.3.7-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2f87a9db620ad971fabdb1ff2e401169b7f0a1e81642565653702705ffe8a1d |
|
MD5 | 3afd29a3216f8c7b627b1f1f70e6b5de |
|
BLAKE2b-256 | afe68d94b3da60c25b53de6134f8ef1c75d1286a5632be0d832a3c4324ece343 |