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

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.14.tar.gz (745.3 kB view details)

Uploaded Source

Built Distributions

asammdf-7.3.14-cp311-cp311-win_amd64.whl (828.7 kB view details)

Uploaded CPython 3.11 Windows x86-64

asammdf-7.3.14-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (853.0 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

asammdf-7.3.14-cp311-cp311-macosx_10_9_x86_64.whl (822.4 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

asammdf-7.3.14-cp310-cp310-win_amd64.whl (828.7 kB view details)

Uploaded CPython 3.10 Windows x86-64

asammdf-7.3.14-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (852.1 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

asammdf-7.3.14-cp310-cp310-macosx_10_9_x86_64.whl (822.4 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

asammdf-7.3.14-cp39-cp39-win_amd64.whl (828.7 kB view details)

Uploaded CPython 3.9 Windows x86-64

asammdf-7.3.14-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (852.0 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

asammdf-7.3.14-cp39-cp39-macosx_10_9_x86_64.whl (822.4 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

asammdf-7.3.14-cp38-cp38-win_amd64.whl (828.7 kB view details)

Uploaded CPython 3.8 Windows x86-64

asammdf-7.3.14-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (852.2 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

asammdf-7.3.14-cp38-cp38-macosx_10_9_x86_64.whl (822.4 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: asammdf-7.3.14.tar.gz
  • Upload date:
  • Size: 745.3 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.14.tar.gz
Algorithm Hash digest
SHA256 68d7029e1f968f921199a7b9dcd6857f0039a53c8652370c02b7168423d69c66
MD5 024c59a4b05fb755b5bb849d92ee223e
BLAKE2b-256 29ab6554e6de0352037395b5172b773d91593c6e1a14a4967a1d989ca306d67f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asammdf-7.3.14-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 828.7 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.14-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 d7e2a4e1a8fa35a5bbaff999f8f3199085ad9884e29c684b5f6239901393f1f4
MD5 a00df59124af9e0ddb929e12928264ce
BLAKE2b-256 c6877a543bedf4b175d0af49de1a6d467dd874c8e2ff4bc76af65d11b1285d76

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asammdf-7.3.14-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7e7e565a2bfaed82ef978d31f005b56686a0418bd4024d02854f40e1186cc5bf
MD5 c43faedd46385e12774803da27b72f6e
BLAKE2b-256 4bbaf9e547dccac875888caab010967f45314fd266c764803724aad4f6fc7883

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asammdf-7.3.14-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b447f575f1a9bc7382e3b1df9d35d24a2830d9032ec59c21d309532834e73f54
MD5 94908d52763c562cc0cdcfb6f3d789d0
BLAKE2b-256 865008546b84b18f5e4167f185eed21107afa647ebe15266863cca54ded31934

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asammdf-7.3.14-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 828.7 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.14-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 8e3dedba63e9ec42bec7267f746d5c0ccde707cbbd3bf9eeb88a4229df23a214
MD5 1cf40974189097007dfe7e79e531a9b1
BLAKE2b-256 f12841fc658039911f88802681b3f16a86e31c1381443e9136bde8cc65d75701

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asammdf-7.3.14-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 36fa5f5ba84fd2483902f13a209c66b3b464812a8d63cea5545b6391c84c640c
MD5 f694572bbc18722bd7d732cfb2b87775
BLAKE2b-256 a4903f105ca2209b7b655025a94535ff2f80d7b03f37491895f5cffaabc2494b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asammdf-7.3.14-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 fc7f3dc708449ef96bd75e6ff4d0d3a256f119e0de87f0c1cfd351486093b7a4
MD5 02bd668d4fb4c65c00eef2acc5502cd0
BLAKE2b-256 330a513c786350e562474ec1b775104037352724dadd7ed8836ba9622029bc48

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asammdf-7.3.14-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 828.7 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.14-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 91bca39d3ad486eb5ddbba4d3f499ded0a507639a0a698e96f5825b173c225e7
MD5 4df84336faada081fbc1d3f3810edc8c
BLAKE2b-256 b7c415ddca4be580f2bfd33f0e23ccb7f02ffe5fd53d910a3d24342749a0cc1f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asammdf-7.3.14-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c74356484156a7be4f17d2121f8616c25e0045a6e1e9209ca5df183a5ae17e13
MD5 0bf4a5cc837083b95162fe77bbba8945
BLAKE2b-256 f09c6c1f69c39befcbf02dc075b57001425f6854b0ff61d23d818f0b6e3899f0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asammdf-7.3.14-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a770e722f68d7d418721881f84658d5d37ee6d6e31dcc3ab316724cf46ec7b6e
MD5 9d20f203d1b29ec6706e4201c3d586e7
BLAKE2b-256 9bd55bcd95b49df08df9e065c28a709a6f0880bf5d4211835c51fb417b726beb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asammdf-7.3.14-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 828.7 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.14-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 2c8a7ad24744675769fd0b85af3b98bd12a4722eeca0bc23a9cf679213df3477
MD5 2fdeb8c846465c31dd35f89c7deafd5d
BLAKE2b-256 8ce9bfaf74c8764e3555300c8376fce98fd15df5c9bdc9ff47cca0ada942e773

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asammdf-7.3.14-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7aaa1adfb400ecd73683b1a98dd771361e0fa542f0b5d0373fea829c85d7d175
MD5 a5b62d274b46f576628f6ac87e325487
BLAKE2b-256 654e0424f0091adcc4c2f717320afd6d27fcc6e07dcae6521c3288d38f23d24d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asammdf-7.3.14-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bdd2577a534e04227b6d7404df6205ca8a94660e5b8eb3a504b5b340071e8080
MD5 9968a65989c727b78e9eb0258fffa5fc
BLAKE2b-256 a51a0439df5802eeaa00b094f1f85116a0e8df2477a1dd4e694487bf514199d7

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