asammdf | Fast Python reader and editor for ASAM MDF | JSON Processing library
kandi X-RAY | asammdf Summary
kandi X-RAY | asammdf Summary
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.7 (for Python 2.7, 3.4 and 3.5 see the 4.x.y releases).
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Save the current MDF file
- Get the block data blocks at the given index
- Load data from the given group
- Load signal data
- Exports the MDF file
- Get a dataframe from a group
- Convert to pandas DataFrame
- Setup the UI
- Translates the UI
- Save the MDF file
- Randomly scramble a MDF file
- Update the aspects of the aspects
- Return a dictionary with the stats for the given cursor
- Concatenate multiple files
- Create a signal that cuts the signal
- Load tabular window
- Stack multiple files
- Extract bus logging
- Opens the menu dialog
- Plot the sample data
- Update the search text
- Paint the image
- Opens the menu at the given position
- Load a plot window
- Convert values to records
- Applies processing
asammdf Key Features
asammdf Examples and Code Snippets
from asammdf import MDF, SUPPORTED_VERSIONS, Signal
import numpy as np
from asammdf.blocks.source_utils import Source
sigs = []
mdf = MDF()
samples = [
np.array([1,1,1,1,1], dtype=np.uint32),
np.array([217056256,217056256,2170562
pip install asammdf[gui]
from asammdf import MDF
mdf = MDF('input.mf4')
mdf.export(fmt='csv', filename='output.csv')
from asammdf.gui.asammdfgui import main
main()
mdf_object = MDF(mdf_file_path)
signals_to_keep = ['v_spd', 'ax_xacc', 'ay_yacc']
mdf_to_plot = mdf_object.filter(signals_to_keep).cut(start=100, stop=240)
mdf_dataframe = mdf_to_plot.to_dataframe()
ax = mdf_dataframe.plot(figsize=(20, 10
>>> ch.timestamps[29040:29050]
array([290.47998, 290.48998, 290.49998, 290.50998, 290.51998, 290.52998,
0.87998, 0.88998, 0.89998, 0.90998])
*** Settings ***
Library C:/SomeFolder/example.py
*** Settings ***
Library ../folder/example.py
import re
with open("resources/input.dat") as f:
lines = f.readlines()
text = "".join(lines)
regex = r"\|(.*?);"
matches = re.finditer(regex, text, re.MULTILINE | re.DOTALL)
data = []
for matchNum, match in enumerate(matches,
from asammdf import MDF
if __name__ == '__main__':
path = 'C:/path/to/some/file.mf4'
mdfObj = MDF(path, version='4.10')
columns=['A','B','C']
# 0.1s
df = mdfObj.to_dataframe(channels=columns, raster=0.1)
# or use t
data = data.applymap(lambda x: np.nan if x==10**10 else x)
Community Discussions
Trending Discussions on asammdf
QUESTION
I install asammdf package to read dat file in python. After installing asammdf using pip install asammdf
, the installation is successful. However, when I import asammdf, I got ldf is not supported
.
May I know how to solve this issue and after installing the asammdf? Moreover I also cannot open the spyder in my anaconda
ANSWER
Answered 2022-Apr-15 at 20:49That is just a warning message from the canmatrix library. If you don't use LIN database file (ldf files) for bus logging decoding then you can just ignore it.
If you really want to make it go away then just install the ldfparser package since this is required for ldf support ( see https://github.com/ebroecker/canmatrix/blob/6ed291b73a5824e367615c99ee1b4e6084eb026e/setup.py#L98)
QUESTION
I am trying to merge some mdf files using asammdf python package. When using MDF.concatenate I get this error:
...ANSWER
Answered 2022-Jan-20 at 17:19You will need to remove the "extra" signals from the files. (you can use the filter method for example)
QUESTION
I'm trying to create a MF4 file to be decoded by a 'J1939.dbc' as the same way of CSS electronics
My code to generate a example file is like this:
...ANSWER
Answered 2021-Mar-18 at 16:04The meta-data for bus logging has to be added as well to the new channel group:
QUESTION
Does asammdf offer the possibility to write unsorted mf4 files? I have seen that it can read both unsorted and sorted mf4 files
If it is possible do you know where I can find a short example?
...ANSWER
Answered 2021-Mar-17 at 22:10The asammdf library always writes sorted files
QUESTION
Background info:
I'm trying to use asammdf to import .dat files in python.
Trying to use "mdf.select(["Channel_name"])" - or variations thereof - gives the following error:
asammdf - ERROR - Multiple occurances for channel "Channel_name": ((2, 18), (2, 18)). Provide both "group" and "index" arguments to select another data group in Python.
I've sort of managed to get it to work by bastardising some other code written by someone else which uses "mdf.channels_db" to eventually extract the channel data.
My issue is that I don't fully understand what I am doing, and therefore not sure I am using this in the most efficient way.
I've been through the asammdf documentation but did not really find an explanation.
What does the error even mean and why am I getting?
My hunch is that it has something to do with the structure of MDF files. Is that correct?
Potentially the Channel Name in question appears more than once in the MDF, but then the location given in the error is the same twice: (2, 18), and this matches with what is see returned by mdf.info()
Any idea where I can find out more?
...ANSWER
Answered 2021-Jan-20 at 20:12Data ia stores in channel groups in the MDF standard. See the intro here https://www.asam.net/standards/detail/mdf/wiki/
To visualize the file internal structure you can use Vector MDFValidator or the asammdf library GUI
QUESTION
I have a dataset of 6 parameters with 500 values each and I want to combine the two of the datasets to get the road curvature but I am getting an error. Since I am new to python, I am not sure that I am using the correct logic or not. Please guide.
...ANSWER
Answered 2021-Jan-13 at 12:39Starting from your dataframe m
QUESTION
I have a dataset of mf4 and I want to convert it into CSV in python. I have read the data from mf4 and convert it into csv (as given below) but I am getting an error, as I am new to python, so unable to find an appropriate method to convert.
...ANSWER
Answered 2020-Dec-18 at 01:48You already have mf4 file. Is this file converted from an mdf file? If it is as I thought, you should use the mdf file to convert it into a CSV file. Here it is anyway and hopefully you or someone else can come up with a better method.
QUESTION
I have logger measurement data as a mdf4 file. I need to visualize some of the signals and save it as an image. While the asammdf GUI can plot signals, I couldn't find a way to save the plot as an image. That's why I'm trying to convert the mdf4 object to pandas dataframe with the build-in asammdf function, plot it with matplotlib and save the plot as an image. Here is the code:
...ANSWER
Answered 2020-Jul-10 at 12:03mdf_object = MDF(mdf_file_path)
signals_to_keep = ['v_spd', 'ax_xacc', 'ay_yacc']
mdf_to_plot = mdf_object.filter(signals_to_keep).cut(start=100, stop=240)
mdf_dataframe = mdf_to_plot.to_dataframe()
ax = mdf_dataframe.plot(figsize=(20, 10), title='Test', grid=True)
ax.figure.savefig(path)
QUESTION
ANSWER
Answered 2020-Apr-15 at 07:09You should look at the comment attributes of the blocks that are interesting to you. See https://asammdf.readthedocs.io/en/latest/api.html#mdf-version-2-3-blocks
Can you give an example of what TXBLOCK needs to be parsed? A MDFValidator screenshot would be nice too.
QUESTION
i have written a custom Library in python, which imports a package named "asammdf". But, when i import my custom Library in Robot code, it shows error in importing "asammdf" in python. It says: "Error in File *.robot. Importing test Library *.py failed. Import Error: DLL load failed: the specified module could not be found."
"asammdf" package is available in one of the PYTHONPATH it mentions during executions.
Can someone please help me doing this and let me know, what have i done wrong? My python File (trialRobot.py):
...ANSWER
Answered 2020-Apr-09 at 16:37You need to provide the absolute path or relative path to the example.py file.
so like,
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install asammdf
github: https://github.com/danielhrisca/asammdf/
PyPI: https://pypi.org/project/asammdf/
conda-forge: https://anaconda.org/conda-forge/asammdf
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page