Skip to main content

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
continuous integration Coverage Status Codacy Badge Documentation Status
PyPI conda-forge
PyPI version conda-forge version

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

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

http://asammdf.readthedocs.io/en/master/benchmarks.html

Project details


Release history Release notifications | RSS feed

This version

7.3.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asammdf-7.3.0.tar.gz (718.1 kB view details)

Uploaded Source

Built Distributions

asammdf-7.3.0-cp311-cp311-win_amd64.whl (802.8 kB view details)

Uploaded CPython 3.11 Windows x86-64

asammdf-7.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (826.7 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

asammdf-7.3.0-cp311-cp311-macosx_10_9_x86_64.whl (796.2 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

asammdf-7.3.0-cp310-cp310-win_amd64.whl (802.8 kB view details)

Uploaded CPython 3.10 Windows x86-64

asammdf-7.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (825.8 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

asammdf-7.3.0-cp310-cp310-macosx_10_9_x86_64.whl (796.1 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

asammdf-7.3.0-cp39-cp39-win_amd64.whl (802.8 kB view details)

Uploaded CPython 3.9 Windows x86-64

asammdf-7.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (825.6 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

asammdf-7.3.0-cp39-cp39-macosx_10_9_x86_64.whl (796.1 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

asammdf-7.3.0-cp38-cp38-win_amd64.whl (802.8 kB view details)

Uploaded CPython 3.8 Windows x86-64

asammdf-7.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (825.9 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

asammdf-7.3.0-cp38-cp38-macosx_10_9_x86_64.whl (796.1 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

File details

Details for the file asammdf-7.3.0.tar.gz.

File metadata

  • Download URL: asammdf-7.3.0.tar.gz
  • Upload date:
  • Size: 718.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for asammdf-7.3.0.tar.gz
Algorithm Hash digest
SHA256 e9ccfd4224b206986742416e10fa0c05151d8cb56f64db66403a34ab01426521
MD5 700a42988d48ab507213d566fe5b8d1f
BLAKE2b-256 135369c3c1524ef2059dcfc200108bba4d496315007f171b385adda6a7c9cf87

See more details on using hashes here.

File details

Details for the file asammdf-7.3.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: asammdf-7.3.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 802.8 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for asammdf-7.3.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 4db824771862df92b0d243632fb9639bdd7306c48e622f53c2772ead902f79b6
MD5 891aaa12b52360be2e1f73e5fbf959dc
BLAKE2b-256 f2ccb5d17e6e37b8fbe5a4d87a74499afe319eddd7a101889eb7508aba8f687d

See more details on using hashes here.

File details

Details for the file asammdf-7.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for asammdf-7.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4c13da9ab3ed7a86024be4f80142947f4d1bd2559866229fd121a3a7d9158849
MD5 44d30707a8080ad9231067ecb9e73af8
BLAKE2b-256 73906d0fbb73224c0ea42b8aac8977cadf77a715587977fab4b846568088e451

See more details on using hashes here.

File details

Details for the file asammdf-7.3.0-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for asammdf-7.3.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 caf03e0a5845321015b3a400108638a00d9523bf806eb9744c2ff7ea70ed786e
MD5 7122e365b3936ea6f57ad6e79fc44bbf
BLAKE2b-256 a2db56510f22390d535d81eb99c5041562513e5f3dbbd3451007bb4275221023

See more details on using hashes here.

File details

Details for the file asammdf-7.3.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: asammdf-7.3.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 802.8 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for asammdf-7.3.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 52ff09b47487b182c94055a5d8959be7eeb2713288c45762febcb62c8626397e
MD5 9196f29d081b13cea2a25fdfd7b3eb44
BLAKE2b-256 948e8fd69e73013077b6f3277fc56adaa10e53ae57d41d885395db9901eef88c

See more details on using hashes here.

File details

Details for the file asammdf-7.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for asammdf-7.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7d41372c58448e679e307c38b94c32a935e5cbaaa39d059796fec4c4acc4c0cf
MD5 c9a51edd91d323888bcd902675f4b04b
BLAKE2b-256 c77d68bce75c99e55bf104658f57ad785762d4f183a18d5fbc85cefdc99406c7

See more details on using hashes here.

File details

Details for the file asammdf-7.3.0-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for asammdf-7.3.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 59f1322fd23fb35c7241f429e80e2b56d0ab44bed7edc4eedff04a65c9e56a75
MD5 3aeee6545faecccc74521474bb76ae12
BLAKE2b-256 9f658ad10798bb5ac47e30172c310a7224e764404651d103475ef4310d546248

See more details on using hashes here.

File details

Details for the file asammdf-7.3.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: asammdf-7.3.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 802.8 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for asammdf-7.3.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 cc11e8247698505c1a8776072d54befe5ede722b2983392956c7907ad2667903
MD5 072c47859ee17f7ff98ce585c7efe1e7
BLAKE2b-256 998146740fc6926b0960af17a7ea9071948a2e5f6d68f13bb57e43014755e833

See more details on using hashes here.

File details

Details for the file asammdf-7.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for asammdf-7.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3a498d36a6ebe68d2b8bdbe7e662f58bcb5df46099caf3528521502ae8bbcacc
MD5 a2a1f7575ccc70df3089a5f6adaac02d
BLAKE2b-256 3aa936038613c53852f7cf204eae4d173951fffc37aecdc9eaa0e38e6a4159a1

See more details on using hashes here.

File details

Details for the file asammdf-7.3.0-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for asammdf-7.3.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e75383ce44355439d6aca8401114842e274fea1238c18f9ee967ade46aa9a0c9
MD5 d393d6565ca0bb77e8de4bdc3b95df0e
BLAKE2b-256 b1d8ed66198b9dd1b42a355314446e8ce32b969e82997d821be461d7f7d84690

See more details on using hashes here.

File details

Details for the file asammdf-7.3.0-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: asammdf-7.3.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 802.8 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for asammdf-7.3.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 3017fcb857623429d11a524baa3141ce9f2f71e604396f7dd05bc8eed9c4a7fe
MD5 3945aaa9e2eb7cbd2f9e6d404725ef48
BLAKE2b-256 7ef9cabcf9f7d42124bd098a75e26073ad48306e7a55f6e8495581968080cb9c

See more details on using hashes here.

File details

Details for the file asammdf-7.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for asammdf-7.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9182838abde34dd0a6b74d4212c3526f48039217452f5d7aa14a280797884f84
MD5 fac1f2f2e8dc27589d51e8f3874960e5
BLAKE2b-256 a666e8c2846c752f86771cd81eb1940552de6b19688cdbaf0ff95c14966295a9

See more details on using hashes here.

File details

Details for the file asammdf-7.3.0-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for asammdf-7.3.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 feb5fea07a951566f128548d534512e83ac1f82ab3b91c4e45772e68ac933aea
MD5 2cd6e5e48bdb1585b071058292bbd34a
BLAKE2b-256 8230387e5a733799041790adf1e34556272aa1505cb6bb3dc693589c27801c3c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page