0

I'm working with a large CAN log and have access to a .mf4 file only. I was wondering whether you can get the timestamp at which a certain signal was sent, much like loading a .log file. I have only encountered mdf.to_dataframe() command whcih requires a raster and completely destroys the sampling time. I need to look at the time it takes for a device on my CAN line to spit consecutive messages.

Thanks

1 Answers1

0
from asammdf import MDF

with MDF('can_logging.mf4') as mdf:
    messages = mdf.get('CAN_DataFrame')
    print(messages.timestamps)
danielhrisca
  • 665
  • 1
  • 5
  • 11
  • Thanks @danielhrisca. I am unable to use `mdf.get('CAN_DataFrame')` as well. I am getting the following error: `AttributeError: 'MDF4' object has no attribute '_raise_on_mutiple_occurences'` I am able to access individual signals though. Not the entire mdf dataframe. – Srivatsank Pullabhotla Jun 15 '21 at 09:08
  • Install the latest development branch code or install versi0on 6.1.2 – danielhrisca Jun 16 '21 at 09:42
  • To get the absolute time, you can add it to `mdf.start_time`. – Thomas Jul 23 '21 at 11:51
  • Again, regarding absolute time: Conversion might be a bit complicated due to accuracy problems. I solved it by using: `mdf.start_time + np.round(messages.timestamps * 1000, 0) * pd.offsets.Milli()` with `import pandas as pd` and `import numpy as np`. There probably is a more efficient way to it, but it works. – Thomas Jul 23 '21 at 12:23