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
- 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.0-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1dff66a7082208e99f486ab7663c35bf6203d9326f1911f03da76db1d822d5ff |
|
MD5 | c3b30e861e170e72a81b7d2800b6c7c3 |
|
BLAKE2b-256 | b33db955bac894fca4e982873587e4e313657f0576e790a26dfb17bb5f7508d7 |
Hashes for asammdf-7.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1337af6176c571751dd73c6e266fc29e051dc546cdff5aa88927a484043634f3 |
|
MD5 | 66a5d7c5c9058affbb525f923edc75d2 |
|
BLAKE2b-256 | 2547b0eb47825836857d0c013e0f076e2a7197f4fd2ccd77d2f4ce21e83e5056 |
Hashes for asammdf-7.4.0-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | be96e96dd53cf7240ebedb4befcb6c05704735e42cf517b84763aedc04c87891 |
|
MD5 | 26302265305a4302fb1b0ca26dbac1fd |
|
BLAKE2b-256 | 433acf5f7a7ece275c2a65b2d181989cfe23643840947c8fa3531680d9f55dd2 |
Hashes for asammdf-7.4.0-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1886fc3b22ba0b5bbd1ee6d390e03cc6b9e6fc33d8e2efc5c7b3e6757d29b9d6 |
|
MD5 | 4e593e7a3537d8e69ff8dc5d7ea3050d |
|
BLAKE2b-256 | af6aabca1feef11751ebf137458de50c406672b8568aeea4726eeebe1d25a33d |
Hashes for asammdf-7.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6034671a54984b3f29dedfae410420c6b66313649f1505921bf059629e7e62f7 |
|
MD5 | bb8d115bc19d03ca5eb1603168e3d51f |
|
BLAKE2b-256 | f9a08983cd4a5dfb02292b0cec0aeb5f74578fe8e0fafa5f2f89fc12ec86af7e |
Hashes for asammdf-7.4.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2fc1c757230e34dc757c1c6c84aebe51dc7939179cc1e569aef59ef5695746c0 |
|
MD5 | 3f5e82bc917b32fc385e6c67dd3f13e2 |
|
BLAKE2b-256 | 9cbb1a7fface0965b1f26764f9c52a56abf7640b9f149eb875b0b44ee7ec1578 |
Hashes for asammdf-7.4.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2e42a629cd29f219a793d88d47bc0fcabc49070d486fdc47e118df23cd900b8 |
|
MD5 | cea6ece59ab4c503469fb5528efcf1b7 |
|
BLAKE2b-256 | 8d76f7a1510e562f161a0b88484c98d4c0570a6f43d8fd6863755aa62b6f4570 |
Hashes for asammdf-7.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56f14511c250f6246b4d5bb3a802201c74f2f53e8efabe1982cec78682fe83c3 |
|
MD5 | d212560151c1aed876c4841771ec28a8 |
|
BLAKE2b-256 | d7de22eba8d5165a77fd4fbbf0e6a3ecaf7aaf84a6a21c3ce65d6989edabb7ae |
Hashes for asammdf-7.4.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0134028caed4ec412add462503c3c78365b60915f13f9421098b50bfc67e3b4 |
|
MD5 | 2da12311f8b546330554c447a02cac7f |
|
BLAKE2b-256 | ac35a64f4771840449443a8332f1700f6b6212c51d957a4aca34d3c5be15c2ac |
Hashes for asammdf-7.4.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fdfd622a15c0bf452f83817117a34e4df73cf97bf9076a8cb7a5f4ffff1e14e3 |
|
MD5 | e2ee4d65a17ea0fe0ec1d8189be29fb8 |
|
BLAKE2b-256 | a623c69c82cf2c7e17b02e8402b8d82c73c86267c56ee6447a428f4cd7c6cb8a |
Hashes for asammdf-7.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59b77b9f28b68327c1f94f59f20983612d0d3b627f7a9fe44d5a20e2d7e05b7f |
|
MD5 | 91f51cebed058b2662614ac40a3d55a6 |
|
BLAKE2b-256 | 8b3e6aec460b6b4d746fa04cdbe6a97db755c87caf3d24a11b24a7eff63c40f3 |
Hashes for asammdf-7.4.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64d072e6734c34274f653449b7b6a11c1f285f8837a00b2897452210997c22f5 |
|
MD5 | 2871a0bb6df7044f5dd540c98f3ed537 |
|
BLAKE2b-256 | 978bc8e1682adf76060ad97fee539055ba742816d3a03d6315f308f03a57777b |
Hashes for asammdf-7.4.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b0d5b97079c45db21697c1cfca49b500cbca04eed815db3de5762ed74c4a05d |
|
MD5 | 43dee49f15ae3e27d29c8cfaee3d72e1 |
|
BLAKE2b-256 | 55e17b5b397c8020eafe46d9ea564c7ccafe6a5ed27b66e401eaa41dc9092c7b |
Hashes for asammdf-7.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aca44640b0a782cfa04387c025bf55fcf53aca8c5ae806c07f6a16129efefb10 |
|
MD5 | 01f5e1a04cfd52372ecb7becad72cd19 |
|
BLAKE2b-256 | e672969a9ec6df9e7e8a6b981385d2d1f33a76f404353660ce7b91f0473ad3dc |
Hashes for asammdf-7.4.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5460b0fbfd0fa0b8a1b2ad16017b3b98fa940fdd2faf35768ab04b6038162bf |
|
MD5 | 37e52c3dae69f132442e2828d952d750 |
|
BLAKE2b-256 | 62ba6e0e8926c5b15b4e381f14147a54b75c21d38b824c4a1cffd7b874431340 |