Skip to content

Commit 58e71ee

Browse files
author
Martin
committed
Updated asammdf API to latest syntax
1 parent 6215750 commit 58e71ee

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

examples/other/asammdf-basics/asammdf_basics.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
About: Load MDF log files & DBCs from an input folder and showcase various operations.
3-
Note: Example assumes v6.0.0+ of asammdf
3+
Note: Example assumes v6.4.4+ of asammdf
44
"""
55
from asammdf import MDF
66
import matplotlib.pyplot as plt
@@ -13,15 +13,17 @@
1313
mdf_extension = ".MF4"
1414
input_folder = "input"
1515
output_folder = "output"
16+
dbc_file = "CSS-Electronics-SAE-J1939-DEMO.dbc"
1617

1718

1819
# load MDF/DBC files from input folder
1920
path = Path(__file__).parent.absolute()
2021
path_in = Path(path, input_folder)
2122
path_out = Path(path, output_folder)
23+
path_in_dbc = Path(path_in, dbc_file)
2224

2325
logfiles = list(path_in.glob("*" + mdf_extension))
24-
dbc = {"CAN": list(path_in.glob("*" + ".DBC"))}
26+
dbc = {"CAN": [(path_in_dbc, 0)]}
2527

2628
signals = ["EngineSpeed", "WheelBasedVehicleSpeed"]
2729
print("Log file(s): ", logfiles, "\nDBC(s): ", dbc)
@@ -55,9 +57,6 @@
5557
# extract a filtered MDF based on a signal list
5658
mdf_scaled_signals = mdf_scaled.filter(signals)
5759

58-
# extract a single signal from the unscaled MDF
59-
mdf_scaled_signal = mdf.get_bus_signal(bus="CAN", name=signals[0], database=dbc["CAN"][0])
60-
6160
# create pandas dataframe from the scaled MDF and e.g. add new signals
6261
pd = mdf_scaled.to_dataframe(time_as_date=True)
6362
pd["ratio"] = pd.loc[:, signals[0]] / pd.loc[:, signals[1]]

examples/other/asammdf-basics/requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
asammdf==6.0.0
1+
asammdf==6.4.4
22
attrs==19.3.0
33
bitstruct==8.11.0
44
canmatrix==0.9.1
@@ -9,10 +9,10 @@ future==0.18.2
99
kiwisolver==1.2.0
1010
lxml==4.6.3
1111
lz4==3.1.0
12-
matplotlib==3.3.0
12+
matplotlib==3.4.3
1313
natsort==7.0.1
1414
numexpr==2.7.1
15-
numpy==1.19.1
15+
numpy==1.21.2
1616
pandas==1.1.0
1717
pathlib2==2.3.5
1818
Pillow==8.2.0

0 commit comments

Comments
 (0)