
Sefram
CHAPTER 6. MDF4 FILE FORMAT
6.5
|
Example
Here’s an example of a Python implementation using the Asammdf library to open an MDF4 record
Listing 6.1: Exemple d’utilisation de la bibliothèque MDF4 en Python
from
asammdf
i m p o r t
MDF
mdf = MDF(
’ sample . mdf ’
)
speed = mdf . g e t (
’ WheelSpeed ’
)
speed . p l o t ( )
i m p o r t a n t _ s i g n a l s = [
’ WheelSpeed ’
,
’ VehicleSpeed ’
,
’ V e h i c l e A c c e l e r a t i o n ’
]
# g e t s h o r t measurement w i t h a s u b s e t o f channels from 10s t o 12s
s h o r t = mdf .
f i l t e r
( i m p o r t a n t _ s i g n a l s ) . c u t ( s t a r t =10 , s t o p =12)
# c o n v e r t t o v e r s i o n 4.10 and save t o d i s k
s h o r t . c o n v e r t (
’ 4.10 ’
) . save (
’ i m p o r t a n t s i g n a l s . mf4 ’
)
# p l o t some channels from a huge f i l e
e f f i c i e n t = MDF(
’ huge . mf4 ’
)
f o r
s i g n a l
i n
e f f i c i e n t . s e l e c t ( [
’ Sensor1 ’
,
’ V o l t a g e 3 ’
] ) :
s i g n a l . p l o t ( )
DAS
User manual
56