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

Uploaded Source

Built Distributions

asammdf-7.3.5-cp311-cp311-win_amd64.whl (820.9 kB view details)

Uploaded CPython 3.11 Windows x86-64

asammdf-7.3.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (845.1 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

asammdf-7.3.5-cp311-cp311-macosx_10_9_x86_64.whl (814.6 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

asammdf-7.3.5-cp310-cp310-win_amd64.whl (820.9 kB view details)

Uploaded CPython 3.10 Windows x86-64

asammdf-7.3.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (844.2 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

asammdf-7.3.5-cp310-cp310-macosx_10_9_x86_64.whl (814.6 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

asammdf-7.3.5-cp39-cp39-win_amd64.whl (820.9 kB view details)

Uploaded CPython 3.9 Windows x86-64

asammdf-7.3.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (844.1 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

asammdf-7.3.5-cp39-cp39-macosx_10_9_x86_64.whl (814.6 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

asammdf-7.3.5-cp38-cp38-win_amd64.whl (820.9 kB view details)

Uploaded CPython 3.8 Windows x86-64

asammdf-7.3.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (844.3 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

asammdf-7.3.5-cp38-cp38-macosx_10_9_x86_64.whl (814.6 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: asammdf-7.3.5.tar.gz
  • Upload date:
  • Size: 735.9 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.5.tar.gz
Algorithm Hash digest
SHA256 ddd98e908dcd3dbf0c8943f67a5cfb23a3579937b9dac6105ad4753e9bfabc98
MD5 75ff03cd33089fc85645f8d6a34bd322
BLAKE2b-256 7415ea05bc25b1b84f47092d9ee2e8d35c9e43500a1ac9cbaae9da72edf28db7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asammdf-7.3.5-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 820.9 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.5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5fdb662fe6f863a6da5567db6a30cba2786e579760111b03129e02c25869ba94
MD5 5246f4953e2074319ff24b37683432c8
BLAKE2b-256 af8d803153ef30e68eae869ccc239695712f853edb7301b356a03826d4296c57

See more details on using hashes here.

File details

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

File metadata

File hashes

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

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asammdf-7.3.5-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 eeb916708ad0b885c3f8c13738596ee644646e9fd6b15ecf5db24707b45011a1
MD5 a32d9e9f9e67cc79737b43ff21386620
BLAKE2b-256 1bb1923d8976592249c044bf9cbc3774205cdab99340b563c594df17c73a64b5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asammdf-7.3.5-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 820.9 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.5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 fd81f6fc8006cc936b749d7038ed5c70fd3857f3c629d613cfcfe95fc7836688
MD5 e63025d61ae81cc38134fc21fa3a33b9
BLAKE2b-256 5e781150c0f92506d8ecd4fbed658ac1615ee9a76979726939d29137036c09e2

See more details on using hashes here.

File details

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

File metadata

File hashes

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

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asammdf-7.3.5-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2b0fac8c34c6659afed60933066ae8fa133e060078aaa2d271b4807e6a7d2d9b
MD5 6e9c381bf5bb89e16e033d21b73f55e2
BLAKE2b-256 f7dc91dff8a3d1a5ca828f765260058dfff47b55847add0cb3578b8550631199

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asammdf-7.3.5-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 820.9 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.5-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 cac9c8e3619897e50f339ddc950dcae20fd38a9a12fd81cc4fa53234b99dfaeb
MD5 332560de69ff1dfccea4da229be9c0f8
BLAKE2b-256 52e7e929f640dbdf7171a85031ea79b6f6f7310f0665c789bbe234ed9123b820

See more details on using hashes here.

File details

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

File metadata

File hashes

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

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asammdf-7.3.5-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6711159b7734a502553c6ee670f898233292bf7d3569ce829054aa42f48d04a5
MD5 d41254e6c2b690196ae4f2f4bbe6c9c1
BLAKE2b-256 16876b03894bbe0b68a221927b0de1b647310921a8bfba3816e1de2e97b74418

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asammdf-7.3.5-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 820.9 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.5-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 8d375ed2151bb726eeed828a490b2e53b5bace6c43773a622af8d0d5a150f025
MD5 d4e857c83b0de9f8511cd6f774b957c2
BLAKE2b-256 7bab3fb1462fd69e2f59abfc76aa76bd1e807b5f86a649f473237e6be33c296e

See more details on using hashes here.

File details

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

File metadata

File hashes

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

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asammdf-7.3.5-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3e86a239239334ec5e54b3fbb7bf655261845e999334ffbe0a9c540fcd0dc5be
MD5 e6b72e010a140582d7249490a2d3179b
BLAKE2b-256 ae94fe5a7b6ad45e41d84539eb21e835912d3d27ed6346ce954812f74ea35437

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