Debian Codegraph @

README.md

raw
1 #
2
3 <img align="left" src="https://raw.githubusercontent.com/danielhrisca/asammdf/master/asammdf.png" alt="logo of asammdf" width="128" height="128" />
4
5 _asammdf_ is a fast parser and editor for ASAM (Association for Standardization of Automation and Measuring Systems) MDF (Measurement Data Format) files.
6
7 _asammdf_ supports MDF versions 2 (.dat), 3 (.mdf) and 4 (.mf4).
8
9 _asammdf_ works on Python >= 3.10
10
11 ![PyPI - Downloads](https://img.shields.io/pypi/dm/asammdf)
12 ![PyPI - License](https://img.shields.io/pypi/l/asammdf)
13 ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/asammdf)
14 ![PyPI - Version](https://img.shields.io/pypi/v/asammdf)
15 [![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)
16 [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
17 [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
18
19 ---
20
21 ![screenshot of the graphical user interface](https://raw.githubusercontent.com/danielhrisca/asammdf/master/gui.png)
22
23 ## Status
24
25 | Continuous Integration | Coveralls | Codacy | ReadTheDocs |
26 | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
27 | [![continuous integration](https://github.com/danielhrisca/asammdf/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/danielhrisca/asammdf/actions/workflows/main.yml) | [![Coverage Status](https://coveralls.io/repos/github/danielhrisca/asammdf/badge.svg?branch=master)](https://coveralls.io/github/danielhrisca/asammdf?branch=master) | [![Codacy Badge](https://api.codacy.com/project/badge/Grade/a3da21da90ca43a5b72fc24b56880c99?branch=master)](https://www.codacy.com/app/danielhrisca/asammdf?utm_source=github.com&utm_medium=referral&utm_content=danielhrisca/asammdf&utm_campaign=badger) | [![Documentation Status](http://readthedocs.org/projects/asammdf/badge/?version=master)](http://asammdf.readthedocs.io/en/master/?badge=stable) |
28
29 | PyPI | conda-forge |
30 | ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
31 | [![PyPI version](https://badge.fury.io/py/asammdf.svg)](https://badge.fury.io/py/asammdf) | [![conda-forge version](https://anaconda.org/conda-forge/asammdf/badges/version.svg)](https://anaconda.org/conda-forge/asammdf) |
32
33 ## Project goals
34
35 The main goals for this library are:
36
37 - to be faster than the other Python-based mdf libraries
38 - to have clean and easy-to-understand code base
39 - to have minimal 3rd party dependencies
40
41 ## Features
42
43 - create new mdf files from scratch
44 - append new channels
45 - read unsorted MDF v3 and v4 files
46 - read CAN and LIN bus logging files
47 - extract CAN and LIN signals from anonymous bus logging measurements
48 - filter a subset of channels from original mdf file
49 - cut measurement to specified time interval
50 - convert to different mdf version
51 - export to pandas, HDF5, Matlab (v7.3), CSV and parquet
52 - merge multiple files sharing the same internal structure
53 - read and save mdf version 4.10 files containing zipped data blocks
54 - space optimizations for saved files (no duplicated blocks)
55 - split large data blocks (configurable size) for mdf version 4
56 - full support (read, append, save) for the following map types (multidimensional array channels):
57 - mdf version 3 channels with CDBLOCK
58 - mdf version 4 structure channel composition
59 - mdf version 4 channel arrays with CNTemplate storage and one of the array types:
60 - 0 - array
61 - 1 - scaling axis
62 - 2 - look-up
63 - add and extract attachments for mdf version 4
64 - handle large files (for example merging two files, each with 14000 channels and 5GB size, on a RaspberryPi)
65 - extract channel data, master channel and extra channel information as _Signal_ objects for unified operations with v3 and v4 files
66 - time domain operation using the _Signal_ class
67 - pandas DataFrames are good if all the channels have the same time base
68 - a measurement will usually have channels from different sources at different rates
69 - the _Signal_ class facilitates operations with such channels
70 - graphical interface to visualize channels and perform operations with the files
71
72 ## Major features not implemented (yet)
73
74 - for version 3
75 - functionality related to sample reduction block: the sample reduction blocks are simply ignored
76 - for version 4
77 - experimental support for MDF v4.20 column oriented storage
78 - functionality related to sample reduction block: the sample reduction blocks are simply ignored
79 - handling of channel hierarchy: channel hierarchy is ignored
80 - full handling of bus logging measurements: currently only CAN and LIN bus logging are implemented with the
81 ability to _get_ signals defined in the attached CAN/LIN database (.arxml or .dbc). Signals can also
82 be extracted from an anonymous bus logging measurement by providing a CAN or LIN database (.dbc or .arxml)
83 - handling of unfinished measurements (mdf 4): finalization is attempted when the file is loaded, however
84 not all the finalization steps are supported
85 - full support for remaining mdf 4 channel arrays types
86 - xml schema for MDBLOCK: most metadata stored in the comment blocks will not be available
87 - full handling of event blocks: events are transferred to the new files (in case of calling methods
88 that return new _MDF_ objects) but no new events can be created
89 - channels with default X axis: the default X axis is ignored and the channel group's master channel
90 is used
91 - attachment encryption/decryption using user provided encryption/decryption functions; this is not
92 part of the MDF v4 spec and is only supported by this library
93
94 ## Usage
95
96 ```python
97 from asammdf import MDF
98
99 mdf = MDF('sample.mdf')
100 speed = mdf.get('WheelSpeed')
101 speed.plot()
102
103 important_signals = ['WheelSpeed', 'VehicleSpeed', 'VehicleAcceleration']
104 # get short measurement with a subset of channels from 10s to 12s
105 short = mdf.filter(important_signals).cut(start=10, stop=12)
106
107 # convert to version 4.10 and save to disk
108 short.convert('4.10').save('important signals.mf4')
109
110 # plot some channels from a huge file
111 efficient = MDF('huge.mf4')
112 for signal in efficient.select(['Sensor1', 'Voltage3']):
113 signal.plot()
114 ```
115
116 Check the _examples_ folder for extended usage demo, or the documentation
117 <http://asammdf.readthedocs.io/en/master/examples.html>
118
119 <https://canlogger.csselectronics.com/canedge-getting-started/ce3/log-file-tools/asammdf-gui/>
120
121 ## Documentation
122
123 <http://asammdf.readthedocs.io/en/master>
124
125 And a nicely written tutorial on the [CSS Electronics site](https://canlogger.csselectronics.com/canedge-getting-started/ce3/log-file-tools/asammdf-gui/).
126
127 ## Contributing & Support
128
129 Please have a look at the [contributing guidelines](CONTRIBUTING.md).
130
131 If you enjoy this library please consider making a donation to the
132 [numpy project](https://numfocus.org/donate-to-numpy) or to [danielhrisca using liberapay](https://liberapay.com/danielhrisca/donate).
133
134 [![Donate using Liberapay](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/danielhrisca/donate)
135
136 ### Contributors
137
138 Thanks to all who contributed with commits to _asammdf_:
139
140 [![profile pictures of the contributors](https://contrib.rocks/image?repo=danielhrisca/asammdf)](https://github.com/danielhrisca/asammdf/graphs/contributors)
141
142 ## Installation
143
144 _asammdf_ is available on
145
146 - GitHub: <https://github.com/danielhrisca/asammdf/>
147 - PyPI: <https://pypi.org/project/asammdf/>
148 - conda-forge: <https://anaconda.org/conda-forge/asammdf>
149
150 ```shell
151 pip install asammdf
152 # for the GUI
153 pip install asammdf[gui]
154 # or for anaconda
155 conda install -c conda-forge asammdf
156 ```
157
158 In case a wheel is not present for your OS/Python versions and you
159 lack the proper compiler setup to compile the C-extension code, then
160 you can simply copy-paste the package code to your site-packages. In this
161 way the Python fallback code will be used instead of the compiled C-extension code.
162
163 ## Dependencies
164
165 asammdf uses the following libraries
166
167 - numpy : the heart that makes all tick
168 - numexpr : for algebraic and rational channel conversions
169 - wheel : for installation in virtual environments
170 - pandas : for DataFrame export
171 - canmatrix : to handle CAN/LIN bus logging measurements
172 - natsort
173 - lxml : for canmatrix arxml support
174 - lz4 : to speed up the disk IO performance
175 - python-dateutil : measurement start time handling
176
177 Optional dependencies needed for exports
178
179 - h5py : for HDF5 export
180 - hdf5storage : for Matlab v7.3 .mat export
181 - pyarrow : for parquet export
182 - scipy: for Matlab v4 and v5 .mat export
183
184 Other optional dependencies
185
186 - PySide6 : for GUI tool
187 - pyqtgraph : for GUI tool and Signal plotting
188 - matplotlib : as fallback for Signal plotting
189 - chardet : to detect non-standard Unicode encodings
190 - pyqtlet2 : for the GPS window
191 - isal : for faster zlib compression/decompression
192 - fsspec : access files stored in the cloud
193
194 ## Benchmarks
195
196 <http://asammdf.readthedocs.io/en/master/benchmarks.html>