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

Uploaded Source

Built Distributions

asammdf-7.3.13-cp311-cp311-win_amd64.whl (828.6 kB view details)

Uploaded CPython 3.11 Windows x86-64

asammdf-7.3.13-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (852.9 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

asammdf-7.3.13-cp311-cp311-macosx_10_9_x86_64.whl (822.3 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

asammdf-7.3.13-cp310-cp310-win_amd64.whl (828.6 kB view details)

Uploaded CPython 3.10 Windows x86-64

asammdf-7.3.13-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (852.0 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

asammdf-7.3.13-cp310-cp310-macosx_10_9_x86_64.whl (822.3 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

asammdf-7.3.13-cp39-cp39-win_amd64.whl (828.6 kB view details)

Uploaded CPython 3.9 Windows x86-64

asammdf-7.3.13-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (851.9 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

asammdf-7.3.13-cp39-cp39-macosx_10_9_x86_64.whl (822.3 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

asammdf-7.3.13-cp38-cp38-win_amd64.whl (828.6 kB view details)

Uploaded CPython 3.8 Windows x86-64

asammdf-7.3.13-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (852.1 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

asammdf-7.3.13-cp38-cp38-macosx_10_9_x86_64.whl (822.3 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: asammdf-7.3.13.tar.gz
  • Upload date:
  • Size: 745.2 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.13.tar.gz
Algorithm Hash digest
SHA256 5dff4d8660d432762dca422460d48ae3d3e5b3c90247265163c62901edac0e8b
MD5 f66f7f64560a2f55dbe1d9d4a0f8c962
BLAKE2b-256 2cf19c0c975516dc05d51c286981cd558222ea3276f426dc914c880fd44ea235

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asammdf-7.3.13-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 828.6 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.13-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 de533b65c0a90ec957c333381457d7b0c1bf937137d9b75cb08c1739529e077d
MD5 3d85bb29ff94023c6422a718f233bec5
BLAKE2b-256 1c3ba83900ca038bc58c3c3b4c9518062752e6839e1b64c50c55b86481be475e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asammdf-7.3.13-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 834b0cdc334f469e7608a82afa8d56467275bb37b4e0e8fc72b0e9b45c3f208c
MD5 82cfa3e150fef70aa503478c81597d32
BLAKE2b-256 20ecdc9eb3ad6e66541bdc841e1ce3ad4a130887da4883c68d598b617095c689

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asammdf-7.3.13-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7c5f389b28d4ca463040619e7834d20e214c98cbe6d16a56fe65cb9e55d3b100
MD5 b262a0c81e29d1d2cb0208f96843ead6
BLAKE2b-256 138d39c665baf54a41ba3a6b21dca884131d54ff3044a3f93633e90be669f99c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asammdf-7.3.13-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 828.6 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.13-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 2fe75a6b415e53172c12375e889aee6d56f103e0d946d5845382f552f24b7976
MD5 d7d63e8d6fd374bbc383c4afb753151a
BLAKE2b-256 72647c5a80c5c362267d34814503f40cbdf202b7ce198e15edb150c0c02ddfe3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asammdf-7.3.13-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 feab7526907e400db26236ad3e46e2c2303a52d7292ed4cbec641f8b1bc86cf8
MD5 f05db9133790a27e5fdddd54e930049e
BLAKE2b-256 47de116eae817c040e6735e8f6031fdb16780fefa69d45d01b4bade127618e78

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asammdf-7.3.13-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 df392f3da0dc1c5c49ec9f90ae44f8915f27d1edd412b7f008cfd828628e86cf
MD5 ae9b3162f3b4f193b8c448f8bf1a46a9
BLAKE2b-256 b278a9092f0d611cb2378bdeb7a5f1df6422a25ac17ccbe520251a79ee713179

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asammdf-7.3.13-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 828.6 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.13-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 43f6d4ce9ba2f9a10930202353634a38b6a964887fe8acdb4157b42a927c26ae
MD5 4db799cbe894ee0471c04205a2b3a961
BLAKE2b-256 3cd77f82106b8ca9f7fdba95f73afdf45d42a60dd3b6d72e6cc930d964b8f35b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asammdf-7.3.13-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 624b3ae473c63880acf941974c26d5e5c9c9d3b56a8e7aee972aecc503e76b3e
MD5 49af43098bf626397c69ef9c224a77e4
BLAKE2b-256 ad559b47e4ff2d2e1a27f46bc2464155460d09d74ed8ba380a84070498ab0916

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asammdf-7.3.13-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b7c5958d3d0636fba054c6df2280215bfff3dd7cc4ba04aab58288db90d0ee0b
MD5 44ec6af442a2cdba7d3953f71a35f9ba
BLAKE2b-256 6580fe2b410e7cecd8306e4d5d27350c3e36577668e9dd701a73cb86f6c05e6e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asammdf-7.3.13-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 828.6 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.13-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 a2bb4ad2fc511a1b9c53a71b8a9f70abb953f3ea89fdc4c56e1a4777b76784b2
MD5 4677828f6115d0d422a0f9ef354ee53f
BLAKE2b-256 fe274d1356553dea64eb010bccb0839d2a86de824c1ad1ccf788952c99b8418a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asammdf-7.3.13-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 38d7bd95a84620db430f5eb7dc0a0697765c02a5b159faf2bc6ca8e5d16954f9
MD5 6a8eb8a328e3798b0ec2609ab5664ddd
BLAKE2b-256 d1027daf6f8243f2b98a85ada6f92805b4a872a5608e496917fd3faa19ab04b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asammdf-7.3.13-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ab37c9699ecf7f344cebc3086bb40e2ce267fd63cf5a9a0ef0168cc62b03a7b5
MD5 01c178ea18dd501d2ff2377b49a54ae0
BLAKE2b-256 b1fcfeba3da4bd83b1dc2b400df643f8db4e0f48c5e25a4000d73c4ba12f7b87

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