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/ce3/log-file-tools/asammdf-gui/
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
- faust-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.4.5-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1fb96492e4fbb764b01d9dce17e3ca036f6690651fb4d0c64004cb4a43447dd1 |
|
MD5 | 2c0e17284a9e9ce3bca35f4b662f04b9 |
|
BLAKE2b-256 | a7ff2911dabd9ed4e62803d606e81dd24e66f0d88f060b789b19298b936d60e3 |
Hashes for asammdf-7.4.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9e5809e4bb20e0b7bfb9aae411a1088f93176d7dbf59fb6023e4f57da6ff958 |
|
MD5 | e17ebc4534085394778a115ae9b42bf8 |
|
BLAKE2b-256 | 4dcf2ee738d80bf711e2b6e78ef59383036f7dfdf87abf8efeb6aac91efc35ef |
Hashes for asammdf-7.4.5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3523a2e8297748e43fff809964ecf7fd8053566efa48dfb7a75bfd584d45cef3 |
|
MD5 | 440e63c601ca890c6a29764bd7b8c6e2 |
|
BLAKE2b-256 | 0a5a8662bdf8a2fe0accde43d9011f5a7d3de47fce842ec59da61e8f3233456c |
Hashes for asammdf-7.4.5-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15544078c17ea5718484f233bafcdcaedea2a3773e22c1589afde657478745d5 |
|
MD5 | 874fcd96d2dba6ef9e7810768dd63cb6 |
|
BLAKE2b-256 | 8fc3942fa05153fe9b28a17806ac51e82cf81991b2adeca7b800d23abd37a8ee |
Hashes for asammdf-7.4.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50c37645eb54ed96d06a677a4b021b68d60c53436d12e07e27dda1a28bce5d08 |
|
MD5 | 29234e08de1db2b8eee6df0eb5bc4614 |
|
BLAKE2b-256 | c5e807f3c1b1fa7c203ed122ef6a2125ae9880c0690d9fd2f2c40b3204c49d8c |
Hashes for asammdf-7.4.5-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c85d1136ccce61bec6e39df06075f99bf36b46ac6c83b54065f4e545dd690130 |
|
MD5 | d8668f9c516db608eccdcc94a3630728 |
|
BLAKE2b-256 | 8ff6b30902e2ab38632bc6fb9651411dc067e06de44da1cdf94ff8dec3766cc0 |
Hashes for asammdf-7.4.5-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8dccc6989108873fc0043feba3b078c81dbadd9cd6edc20d81d9f6fd8470f863 |
|
MD5 | b5142d9ebc19fa2125dc0af4d41c4775 |
|
BLAKE2b-256 | 8d47784abda660801ab95b171f71bfd8b8af57611e288fc1baf54ef421375df9 |
Hashes for asammdf-7.4.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8448e2aee40fb2509fe1e4ec88c1ef861e95c35deafa1df595f4e5a1cb3a7c6a |
|
MD5 | a1f8e53633449beaa7676c4975dc0cba |
|
BLAKE2b-256 | c0c5e4d34177218f782e581212dff303ad1108d01e05bfd842abd6754c25a468 |
Hashes for asammdf-7.4.5-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d6e10232bb1b35c90e0f1f0c72a5562f45c23e6035046d631eea67c2d6d88b9 |
|
MD5 | 9599f69167266312139c62408bf24f62 |
|
BLAKE2b-256 | ce7e2b6977fa09d8fe044e2bae82f955a8e7504c00f4c8e1d3a21fc7b04d4e4a |
Hashes for asammdf-7.4.5-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29383a0e49d5faf46f4b2d7730b576f42b34c08e68ac1089c49d297ad68b8cb1 |
|
MD5 | d2ea9b5ae33c1b6575bc003229acbf53 |
|
BLAKE2b-256 | f0162bb495db07cec4fbacb157b7fcf749fd3b6cfaf063376134cd6a9a9ccdf2 |
Hashes for asammdf-7.4.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1d178b9364d0123fd684637652ceddc796366730fd5e0e652d76c0dceb653e0 |
|
MD5 | d1c84bff9310b6e66fe7038fb31b3943 |
|
BLAKE2b-256 | 1aabcaa2c809ff3cec7ffba9a48ca49e683d0f894aa985e1be32c0f0dbe95339 |
Hashes for asammdf-7.4.5-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | edad2ffb9d83c1d381327acfd6cf10e6336e45853a0adc6fdaaf0eaa3ba7ac65 |
|
MD5 | 57b6425864f9c688cd55e99ac685d69f |
|
BLAKE2b-256 | 0fe7571ccd9a29e64b3f61e8ed0c8a64a8aeb9f078003444c809008a7a2cb313 |
Hashes for asammdf-7.4.5-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5f7e4084c35259e9be33e2893adfe181b067c813d95bd2c6135aacc3b88d56d |
|
MD5 | 56059865ace1091142a5d402cfea5a8a |
|
BLAKE2b-256 | 68c5aad4a996e77a83dc869e0f54d35b6e00db56fceb2587b03d954ae4dec0a5 |
Hashes for asammdf-7.4.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81ff7cbafd72e190838d9895b6e6b32a30b44fb3a18aadc99adbbe2f532f468a |
|
MD5 | c1e4b5888e4bf0b2086671dfd4eb459d |
|
BLAKE2b-256 | dce01da6067ae77b0ef2b2aa8a8026fd0baf40efd6f0f8ec797abb901366f522 |
Hashes for asammdf-7.4.5-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c6a62b2a4350b14cfc92aa3e8b4f404afcf79f7d275f1fa1644519d1239dd14 |
|
MD5 | 843aa5a37f18c6365a83da6678396f76 |
|
BLAKE2b-256 | 8ef334b52bd1545992ad50c4fb933dee80918f1c682126b25cd10697391c9263 |