danielhrisca / asammdf

Fast Python reader and editor for ASAM MDF / MF4 (Measurement Data Format) files
GNU Lesser General Public License v3.0
633 stars 224 forks source link

Using specific raster causes false interpolation where no interpolation should be required #887

Closed hnxbosch closed 11 months ago

hnxbosch commented 1 year ago

Python version

('python=3.10.11 | packaged by Anaconda, Inc. | (main, Apr 20 2023, 18:56:50) ' '[MSC v.1916 64 bit (AMD64)]') 'os=Windows-10-10.0.19045-SP0' 'numpy=1.23.5' ldf is not supported 'asammdf=7.3.2'

Code

MDF version

'4.10'

Code snippet

from asammdf import MDF
mdf = MDF("mock_logger.mf4")
mdf.to_dataframe(channels=["channel_a","channel_b"],raster=0.05)

Description

The created dataframe shows wrong values in the channels when using a raster. This seems to be caused by interpolation. However The raster of 0.05 exactly matches the frequency of the channels in the mf4. So i would expect the values to be equal to the raw values you can find when inspecting the mf4 file with MDA or loading it without specifying a raster. channel_a for example turns out as [2,2,0,4,0,2,2,8,2,0,0,0,4,4,2,0,0,0,0,4] but should be [2,2,0,4,0,2,4,8,2,0,0,2,4,2,2,0,0,0,4,4]

You can see there seems to be interpolation using the previous value where the results differ.

mock_logger.zip

danielhrisca commented 11 months ago

@hnxbosch please try the development branch code