Closed RegularnaMatrica closed 3 months ago
I've made some changes in the development branch. You can provide the raw
argument as a dict:
__default__
from asammdf import MDF
m = MDF(r'c:\ASAP2_Demo_V171.mf4')
print(m.to_dataframe(["ASAM.M.SCALAR.UBYTE.FORM_X_PLUS_4", "ASAM.M.SCALAR.UBYTE.TAB_INTP_DEFAULT_VALUE"]))
print(m.to_dataframe(["ASAM.M.SCALAR.UBYTE.FORM_X_PLUS_4", "ASAM.M.SCALAR.UBYTE.TAB_INTP_DEFAULT_VALUE"], raw=False))
print(m.to_dataframe(["ASAM.M.SCALAR.UBYTE.FORM_X_PLUS_4", "ASAM.M.SCALAR.UBYTE.TAB_INTP_DEFAULT_VALUE"], raw=True))
print('------------')
print(m.to_dataframe(["ASAM.M.SCALAR.UBYTE.FORM_X_PLUS_4", "ASAM.M.SCALAR.UBYTE.TAB_INTP_DEFAULT_VALUE"], raw={"__default__": True}))
print(m.to_dataframe(["ASAM.M.SCALAR.UBYTE.FORM_X_PLUS_4", "ASAM.M.SCALAR.UBYTE.TAB_INTP_DEFAULT_VALUE"], raw={"__default__": False}))
print('------------')
print(m.to_dataframe(["ASAM.M.SCALAR.UBYTE.FORM_X_PLUS_4", "ASAM.M.SCALAR.UBYTE.TAB_INTP_DEFAULT_VALUE"], raw={"__default__": True, "ASAM.M.SCALAR.UBYTE.FORM_X_PLUS_4": False}))
print(m.to_dataframe(["ASAM.M.SCALAR.UBYTE.FORM_X_PLUS_4", "ASAM.M.SCALAR.UBYTE.TAB_INTP_DEFAULT_VALUE"], raw={"__default__": False, "ASAM.M.SCALAR.UBYTE.FORM_X_PLUS_4": True}))
ASAM.M.SCALAR.UBYTE.FORM_X_PLUS_4 ASAM.M.SCALAR.UBYTE.TAB_INTP_DEFAULT_VALUE
timestamps
0.000000 29.0000 111.0
0.001000 29.0000 111.0
0.002000 29.0000 111.0
0.003000 29.0000 111.0
0.004000 29.0000 111.0
... ... ...
12.398015 159.2775 111.0
12.399015 159.0775 111.0
12.399403 159.0000 111.0
12.400015 159.0000 111.0
12.401015 159.0000 111.0
[13642 rows x 2 columns]
ASAM.M.SCALAR.UBYTE.FORM_X_PLUS_4 ASAM.M.SCALAR.UBYTE.TAB_INTP_DEFAULT_VALUE
timestamps
0.000000 29.0000 111.0
0.001000 29.0000 111.0
0.002000 29.0000 111.0
0.003000 29.0000 111.0
0.004000 29.0000 111.0
... ... ...
12.398015 159.2775 111.0
12.399015 159.0775 111.0
12.399403 159.0000 111.0
12.400015 159.0000 111.0
12.401015 159.0000 111.0
[13642 rows x 2 columns]
ASAM.M.SCALAR.UBYTE.FORM_X_PLUS_4 ASAM.M.SCALAR.UBYTE.TAB_INTP_DEFAULT_VALUE
timestamps
0.000000 25 100
0.001000 25 100
0.002000 25 100
0.003000 25 100
0.004000 25 100
... ... ...
12.398015 157 83
12.399015 157 83
12.399403 155 83
12.400015 155 84
12.401015 155 84
[13642 rows x 2 columns]
------------
ASAM.M.SCALAR.UBYTE.FORM_X_PLUS_4 ASAM.M.SCALAR.UBYTE.TAB_INTP_DEFAULT_VALUE
timestamps
0.000000 25 100
0.001000 25 100
0.002000 25 100
0.003000 25 100
0.004000 25 100
... ... ...
12.398015 157 83
12.399015 157 83
12.399403 155 83
12.400015 155 84
12.401015 155 84
[13642 rows x 2 columns]
ASAM.M.SCALAR.UBYTE.FORM_X_PLUS_4 ASAM.M.SCALAR.UBYTE.TAB_INTP_DEFAULT_VALUE
timestamps
0.000000 29.0000 111.0
0.001000 29.0000 111.0
0.002000 29.0000 111.0
0.003000 29.0000 111.0
0.004000 29.0000 111.0
... ... ...
12.398015 159.2775 111.0
12.399015 159.0775 111.0
12.399403 159.0000 111.0
12.400015 159.0000 111.0
12.401015 159.0000 111.0
[13642 rows x 2 columns]
------------
ASAM.M.SCALAR.UBYTE.FORM_X_PLUS_4 ASAM.M.SCALAR.UBYTE.TAB_INTP_DEFAULT_VALUE
timestamps
0.000000 29.0000 100
0.001000 29.0000 100
0.002000 29.0000 100
0.003000 29.0000 100
0.004000 29.0000 100
... ... ...
12.398015 159.2775 83
12.399015 159.0775 83
12.399403 159.0000 83
12.400015 159.0000 84
12.401015 159.0000 84
[13642 rows x 2 columns]
ASAM.M.SCALAR.UBYTE.FORM_X_PLUS_4 ASAM.M.SCALAR.UBYTE.TAB_INTP_DEFAULT_VALUE
timestamps
0.000000 25 111.0
0.001000 25 111.0
0.002000 25 111.0
0.003000 25 111.0
0.004000 25 111.0
... ... ...
12.398015 157 111.0
12.399015 157 111.0
12.399403 155 111.0
12.400015 155 111.0
12.401015 155 111.0
[13642 rows x 2 columns]
I need to read specific signals from MDF file, but some signals should be read as raw. I know in advance which signals should be read as raw. It seems that
raw
parameter into_dataframe
accepts single value and not value for each of specified signal. Is there some way to achieve that some signals are read raw while others not?My approach is to create new
MDF
with usingappend
in a loop for wanted signals which are retrieved withget
with specifiedraw
parameter. After retrieving I putsignal.raw = False
and append. At the end I useto_data.frame
and this approach seems to work, but its 'hacky' way of doing it. Is there maybe more straightforward and clear way?