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.5-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5fdb662fe6f863a6da5567db6a30cba2786e579760111b03129e02c25869ba94 |
|
MD5 | 5246f4953e2074319ff24b37683432c8 |
|
BLAKE2b-256 | af8d803153ef30e68eae869ccc239695712f853edb7301b356a03826d4296c57 |
Hashes for asammdf-7.3.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ced3e312a84cf3ca020cd474fa3801f9686648e37ac9a74e8424e08da7dc572 |
|
MD5 | b895b2d8ff65bb06c4b61aa10dcba220 |
|
BLAKE2b-256 | e0100215270507f7042580195a7fe01dd26861ca0c147c09cf9b879353833dd4 |
Hashes for asammdf-7.3.5-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eeb916708ad0b885c3f8c13738596ee644646e9fd6b15ecf5db24707b45011a1 |
|
MD5 | a32d9e9f9e67cc79737b43ff21386620 |
|
BLAKE2b-256 | 1bb1923d8976592249c044bf9cbc3774205cdab99340b563c594df17c73a64b5 |
Hashes for asammdf-7.3.5-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd81f6fc8006cc936b749d7038ed5c70fd3857f3c629d613cfcfe95fc7836688 |
|
MD5 | e63025d61ae81cc38134fc21fa3a33b9 |
|
BLAKE2b-256 | 5e781150c0f92506d8ecd4fbed658ac1615ee9a76979726939d29137036c09e2 |
Hashes for asammdf-7.3.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d7983d4c8f950a24ded71eeea421ff2e5223375ed9feed8065ad01e2abe4867 |
|
MD5 | 2853e722d541e8d92be5ddff06921f9b |
|
BLAKE2b-256 | 7eed3a09eb88fbe667ee8f6c8206ce555b3bba1efb9b45f259b9b2c16a038e31 |
Hashes for asammdf-7.3.5-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b0fac8c34c6659afed60933066ae8fa133e060078aaa2d271b4807e6a7d2d9b |
|
MD5 | 6e9c381bf5bb89e16e033d21b73f55e2 |
|
BLAKE2b-256 | f7dc91dff8a3d1a5ca828f765260058dfff47b55847add0cb3578b8550631199 |
Hashes for asammdf-7.3.5-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cac9c8e3619897e50f339ddc950dcae20fd38a9a12fd81cc4fa53234b99dfaeb |
|
MD5 | 332560de69ff1dfccea4da229be9c0f8 |
|
BLAKE2b-256 | 52e7e929f640dbdf7171a85031ea79b6f6f7310f0665c789bbe234ed9123b820 |
Hashes for asammdf-7.3.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed096249dab5ca0c311769482daeaf904222cd81781b713088b214bc0984ce50 |
|
MD5 | fb145c5972a329d94f7d5a4571f16924 |
|
BLAKE2b-256 | 144d6827e2d792059d7d1e465a0d3544121680c8dae1f385dc88b6f7eb3c3b3f |
Hashes for asammdf-7.3.5-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6711159b7734a502553c6ee670f898233292bf7d3569ce829054aa42f48d04a5 |
|
MD5 | d41254e6c2b690196ae4f2f4bbe6c9c1 |
|
BLAKE2b-256 | 16876b03894bbe0b68a221927b0de1b647310921a8bfba3816e1de2e97b74418 |
Hashes for asammdf-7.3.5-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d375ed2151bb726eeed828a490b2e53b5bace6c43773a622af8d0d5a150f025 |
|
MD5 | d4e857c83b0de9f8511cd6f774b957c2 |
|
BLAKE2b-256 | 7bab3fb1462fd69e2f59abfc76aa76bd1e807b5f86a649f473237e6be33c296e |
Hashes for asammdf-7.3.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe66ed05a14330185a8eafc5bb9641778b9b7353e17901b5c12e804dd494d0d8 |
|
MD5 | e1680e34bdf0c42d5f74fce2c1914d38 |
|
BLAKE2b-256 | baabe8fdb94e1df672e978b2c62795c012f425914e0ca428c53477a177fe4128 |
Hashes for asammdf-7.3.5-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e86a239239334ec5e54b3fbb7bf655261845e999334ffbe0a9c540fcd0dc5be |
|
MD5 | e6b72e010a140582d7249490a2d3179b |
|
BLAKE2b-256 | ae94fe5a7b6ad45e41d84539eb21e835912d3d27ed6346ce954812f74ea35437 |