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.2-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88c486648822dca448c04b70aa024ce838b402cb0fb860dd6f5ccbc89054d2e5 |
|
MD5 | 9f1588d4179f175a9239505d178d47fd |
|
BLAKE2b-256 | 6e791bf769746cb96aa414fd20573a817a9d306584a4ee2070c38a556ab8a57e |
Hashes for asammdf-7.4.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc80326c3e01e0a1b11ddda1cb3636debce1382cc63a8ef387b91b5f88d111fe |
|
MD5 | 8d9a865945fa57fba02238a5f2b84b69 |
|
BLAKE2b-256 | d582ac581d51c6d175c4b0be361df37c886cab38312f9fa53889a94e2c1b66ad |
Hashes for asammdf-7.4.2-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ca49b3b964d050a20a2a8f32d821089be111d8e5968033f067f5cfea5263f10 |
|
MD5 | a15c5250072abf4544a0207380b74238 |
|
BLAKE2b-256 | caf07ef4ac1c348272707f387a66eadc55c4699e46eff7d995f9f963693ac725 |
Hashes for asammdf-7.4.2-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92283086c2d5ddf1bf2d1bf88510e54a272778e3d25c8cbe722746c8f5edbca3 |
|
MD5 | 65ee4665d1b2123f53f279c49d29b80d |
|
BLAKE2b-256 | afa2706b4e8538199726dc955220a38970f5989039338457e35f29a0e966c8ba |
Hashes for asammdf-7.4.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0afdb34c331078fbc5c101ac6dfe64b9e20b4c4b424f55f69cc78fee2737c001 |
|
MD5 | a018447a63055c8cd7539bf406bfa338 |
|
BLAKE2b-256 | a6b31e9b6109c518e00a506cf455f7e7ea89cb10887ea4719288016550f6d4af |
Hashes for asammdf-7.4.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0194c886fea9ce64f3acfd9d73eae93f95a7ff827e049ff5773df2eb7a4cd313 |
|
MD5 | 7c97afa2489aa5e474f81dfa2a6c779a |
|
BLAKE2b-256 | e86515578dcaf2ebc83fde53fd638f9de0041afd4d0e8e0466183a115c2bdf59 |
Hashes for asammdf-7.4.2-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 925e439e047941d1e9a2444e8805093e59d1ca187393b9bf8cc72edaad7f740d |
|
MD5 | 832c8d6527aaf3e02fdf94f7c5fe8ad7 |
|
BLAKE2b-256 | 90d68742a1c93cc74c2fdb2c9ed6656b880d515055ee09a912d39bfe2e8b726b |
Hashes for asammdf-7.4.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 681e1c432d9c23865aee1e03c1b95cab4f3f5654a1031c4590ac7e4fddafcbd9 |
|
MD5 | 5b05cdc011109da0ed46ba1c198bccb6 |
|
BLAKE2b-256 | d4fb668681e3b80eb83d8749c5cc789a57bf690df087bd9dcdde0bd12da5bf9d |
Hashes for asammdf-7.4.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0209f3f9bf203e5a30c2d03fa94d620547eb00774af650459e151e0389161435 |
|
MD5 | 1c0c5ca86687467e08cbf3e06ea68fb0 |
|
BLAKE2b-256 | 06542cca160e41c38b33695eb5c88a35fc6ec72244f35f805cd86d54fd13e04e |
Hashes for asammdf-7.4.2-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22cfb46de451504847a504a0515900f83c1e80b9f86042c2f852639f963c6fbd |
|
MD5 | dbc587c0410bb0ba655cebf6a0b5f919 |
|
BLAKE2b-256 | 6a90bf05179aff95dae4fbb26c54e7da139477d9c9b9def956a8d40f08a826b8 |
Hashes for asammdf-7.4.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65e5d95e9503fec632112c846a879983442f3759a769fa8fa95d7d2627e2aa66 |
|
MD5 | 0f5ba46c53d680614b95807a8381f777 |
|
BLAKE2b-256 | 11d4473c017834fceb79f15d120bf951495f02dffb44b0d66623223e5299dbe9 |
Hashes for asammdf-7.4.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba833997e8dff42325e850fc84d4cf9b2c499d16eb1940807705c5c7eba36d5c |
|
MD5 | cfa72533c87a3eac2fea2e8d82b43be5 |
|
BLAKE2b-256 | a5d656b8b60538e062cb4a1e38ec35bb2a5554992e24dd47dcdbcf57143b2d5f |
Hashes for asammdf-7.4.2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72670476b4840b6f4a7d36d96e1f3855e7d91498ecf314c538653a8719e0ddd3 |
|
MD5 | ff97495761e7f26a8f12902c00bf38b7 |
|
BLAKE2b-256 | 2601ce26bc97c7d4c70dcd87593f346915b073e77402c1f2e0666d03bb6a5771 |
Hashes for asammdf-7.4.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | db5f7eb8a3be2ea57af181edf2ad5ef1fb50f3e58fe2a95cebdb4d95693aca0c |
|
MD5 | 4736c421d6a26b6e71faa55691e5603b |
|
BLAKE2b-256 | 38cc8d9f904aaff9992f0d19a1441075f12612ef02e27bfd8fada3bc1b8761c0 |
Hashes for asammdf-7.4.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43a3f7083c89762553a3cd90ffa70fa724968327ba23370e16e7b8c5c9929c91 |
|
MD5 | 6c386cb1ade3f2dda7563e3046489620 |
|
BLAKE2b-256 | afa403f3adf085d514544d7c6a0e37d7bbcfcc21f6eb0acc35192f4b8e856a38 |