asammdf icon indicating copy to clipboard operation
asammdf copied to clipboard

Resample data with virtual time master channel

Open fhaon opened this issue 1 year ago • 1 comments

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])

fhaon avatar May 21 '24 10:05 fhaon

@fhaon please try the development branch code

danielhrisca avatar May 27 '24 07:05 danielhrisca

The modification works. I close the issue. Thanks !

fhaon avatar Jul 26 '24 08:07 fhaon