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.2-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73aa55abdec5aeaeac309546c34b0763065b73a6bd9cab903ec6659338a85ad2 |
|
MD5 | 73c4fa6cd1286f90da4fa7885f803ad8 |
|
BLAKE2b-256 | 792cb1f7bac027fa86974553f55fec79b02e17f06d289a9e1fc88b223c11687e |
Hashes for asammdf-7.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5cf46e0ef729c55b09e1dcbc2f5f84564d92ad4752178036d5dcb573bd0c8f6b |
|
MD5 | e9432b06f688e1f8043b817f9de450db |
|
BLAKE2b-256 | d67055949d48ed0c64ac8d7382ad85543ca6da986ec3632059234ddd4b777c50 |
Hashes for asammdf-7.3.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f892fe31b582b85813e0d5489821b31635be5774a84df2f5b6fb6386357747f |
|
MD5 | a03628e301deda62571eff83ef64b950 |
|
BLAKE2b-256 | d4525223bfb9abcf9e60f8307febe42df7e3f1451b3732d59e02b357af436db8 |
Hashes for asammdf-7.3.2-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8c54cdb0b74012c5bbe4c8474ca206be8b9be54641337836135c32823b04e50 |
|
MD5 | fe02990201199e4d65f6f43caeafb897 |
|
BLAKE2b-256 | 20e40d803cb7fffc5e3a032bdde633d6d849d807fe27111ace0307ca6f8ceb5b |
Hashes for asammdf-7.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bec6abc288217182918309272445ae50fed02f78517e84ec829241aaf76304a4 |
|
MD5 | d697c680eb0db25ab4c93e605887d219 |
|
BLAKE2b-256 | 85e43f38274b740c1d90842024396b9f241bbe6c23e91b70af01495069b8c6c0 |
Hashes for asammdf-7.3.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4ee8746726121b2892002bc80e58b5b39c0b9c1d4b656c1a15fa24adc46976a |
|
MD5 | 35505503429489b2a894a1521373e3ee |
|
BLAKE2b-256 | 8a1249a313e7c7a5304c454b4c7329846865bb838181f7b72387be1356a9af0c |
Hashes for asammdf-7.3.2-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8331d392ee0c7004398cf881776bc48af1bfbe9a683d8fdad2fb2d90d7da5d6 |
|
MD5 | 5a1ad88123a88fe33f1b9ce3d8eb6728 |
|
BLAKE2b-256 | 2d843f40a1ddf81722f490bdff7367d57f134adecc1efa425472dea04e619822 |
Hashes for asammdf-7.3.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a8b7cc17e2ac1c1742b2bcc26e0bd9a31556d21d36ba9bf2fede14b11427920 |
|
MD5 | 358e60bbf852ceaf6faaa499a6d81354 |
|
BLAKE2b-256 | 8529e83e026cad7fd7bc4008f5312774a984f5ea918d00dc2f69662242952d20 |
Hashes for asammdf-7.3.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67c742e4afb30768507af0655fc84fc488332704f25fc74902e82928ba242461 |
|
MD5 | e487dae4f93ea56488ecab5be447fb61 |
|
BLAKE2b-256 | be43a293cad75bbd8c32c2d8f234bfb99c2497642671fa953b8193434f5b3860 |
Hashes for asammdf-7.3.2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64314ea357f05567bc7531c11bf0af19c683c0ab1ace699cd5935fcbbd386966 |
|
MD5 | aab78e0e7a8d14094cc0726ce4c760ba |
|
BLAKE2b-256 | 58ef19034d2d9e4e8b62b33d3e6758e3f6a333750f4142254e7f6e12faa828d9 |
Hashes for asammdf-7.3.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88a845044869fe1b561ddd6eeebb1eed2504c65f4a5d9fb7cb838e9c3598dd69 |
|
MD5 | 5eadbd80dc43d81bc75a5147dd247b6a |
|
BLAKE2b-256 | af1585a51efa982448de90e4b22389806fb496f2e69d2e16e1aee79c1dbf13f8 |
Hashes for asammdf-7.3.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 848ce34436bb1d508b39a270238503f6618e937b710239fe878b127ac2145298 |
|
MD5 | d5a6dbbd176e5aad70ed9134ba739ceb |
|
BLAKE2b-256 | 235365baa03c966e7ad71581231d99b922a1393b46c56895137f6e0284f05926 |