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.18-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b27ed2605f4a4d138be8d8f0760546d8c8b4aa045278690436edc3a709abfdcc |
|
MD5 | 071e96792f96162e698268b2f7586236 |
|
BLAKE2b-256 | 5e41f4e43578817c6ce30ab1e35cb781c8dcd8c8aaf3fdb8db0fe5ea094a48c5 |
Hashes for asammdf-7.3.18-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9f78dcf5e3622dcae79629aa00424dc4b73a575f1e08d344a13e0ae920adc71 |
|
MD5 | 9333722fd507b27eaf23420567797f9b |
|
BLAKE2b-256 | 00c5acf6aaf0d3b994c60ecc75440331e645e56f3b32086c974658c280621212 |
Hashes for asammdf-7.3.18-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a6031486c1b009ad797d3c7e9730f92c70552f9a24d82ed7ff71ffee560d856 |
|
MD5 | 4006f0bfd371bbc4314bcd9e8c69ff6f |
|
BLAKE2b-256 | 028789ade0d2393c98474cf596371545317e5eeb30c2de332aced6db1f01c961 |
Hashes for asammdf-7.3.18-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 058c325dca0434c34c882daa5c9b066310cae6fdd624ce169e15a00b44c1fb5f |
|
MD5 | cf73df190b7ef37885897b43089adc6c |
|
BLAKE2b-256 | f93fec06d00059f5e52d209ce4d4ae53884f5c05d6e24f5e887e366b0c6427ee |
Hashes for asammdf-7.3.18-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 158a013f270d3e791990006a9c3b5d690b235612a39e6b155691d7e7450bb7dd |
|
MD5 | 6ab96a9f88ab3b345b7449cac7aecd4d |
|
BLAKE2b-256 | 2eac5d1f1e0b75ae4b04e1532958fceabe55979d00b9e00ff4b271b32e520232 |
Hashes for asammdf-7.3.18-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57cafea7e5d2303ffb0e8b8c33696a0b4ea8a96966973f1dd48a0e8f2ca83dcf |
|
MD5 | 7470b488ea629fb6dc9d843e5da4ef7a |
|
BLAKE2b-256 | 6e4806c21b6f99a99296f5ff1e83800611d71999831c63089921cb31fd9600cd |
Hashes for asammdf-7.3.18-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51f51b259af1e6e347aa16b3709a4638dbd30e650789b07c2d2b1d0db3713f0a |
|
MD5 | ae8c7020409ef0cc0726466f7d8f7dec |
|
BLAKE2b-256 | 408aeb5883002f91fd874389f27a90c4fdc6e835779f87854bf723de4c22c16e |
Hashes for asammdf-7.3.18-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc4a24a6a46f256c161a7faa4e19e7900c6286bfa596954d87b90f8cac09a033 |
|
MD5 | 389c3ce9076f381d703ddc518ab2e359 |
|
BLAKE2b-256 | 9984a4175856242f286ff12c7cded95e483297747fd98156eae05ec1b2433d07 |
Hashes for asammdf-7.3.18-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a11e934471b33c8adb0132bb904eee3ed19fd54664e72b8af24c353f7e0c50bc |
|
MD5 | 3c917e51a33d1e2008c69f591dfdd3e7 |
|
BLAKE2b-256 | a612cfddfdad02befb4a46a2055b3d87ce69c1ce0fd27aaf67e02c21832a9034 |
Hashes for asammdf-7.3.18-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35371d0643ed5b6595a53d2cfcbb3af255dd56479fdbb10e243591f52d3bea15 |
|
MD5 | d62a9f46fbb6f103296138f4d2b48b8f |
|
BLAKE2b-256 | a19f951a317c31fecb094a0f1674f93eb0948694dbbeb26234e29c46794e4354 |
Hashes for asammdf-7.3.18-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a563ab1a361c6e3dc556209dcca18e3feab05d4882640538db90ad9a5be119fd |
|
MD5 | f883e667f745810f12751297e99ad5f3 |
|
BLAKE2b-256 | c4e0884e7369fbe128c217b72bd839ec8254959f8aa61580f35249d622ab2159 |
Hashes for asammdf-7.3.18-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a3aa392f5e019a2c26da6d93045d1ec18ac2e2e425c7b04798dc58c4a0ca296 |
|
MD5 | 217a87fc6eac577a6fd05f531a4fe969 |
|
BLAKE2b-256 | 4ac9b99db7774850ad8fd76183e4be70b99011515d5f3c67348b357551c02681 |