danielhrisca / asammdf

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

Resample data with virtual time master channel #1024

Open fhaon opened 1 month ago

fhaon commented 1 month ago

Python version

('python=3.9.7 (tags/v3.9.7:1016ef3, Aug 30 2021, 20:19:38) [MSC v.1929 64 bit ' '(AMD64)]') 'os=Windows-10-10.0.19044-SP0' 'numpy=1.24.2' 'asammdf=7.4.2'

Code

MDF version

4.10

Code snippet

import sys
from asammdf import MDF

try:

    with MDF(name="E:/Vector_VirtualTimeMasterChannel.mf4") as mdf:
        resampled = mdf.resample(raster=0.06)
        resampled.save(dst="E:/Vector_VirtualTimeMasterChannel_Resampled.mf4", overwrite=True)

except:

    sys.exit(-1)

Traceback

No traceback

Description

Resampling data with a virtual time master channel throws an exception. The Vector_VirtualTimeMasterChannel.mf4 file used for this test is provided with the MDF4 standard. Calling the get_master method to get the last value of the time vector returns an empty array :

master_max = mdf.get_master(group_index, record_offset=cycles_nr - 1, record_count=1)
if len(master_max):
    t_max.append(master_max[0])
danielhrisca commented 1 month ago

@fhaon please try the development branch code