asammdf
asammdf copied to clipboard
cleanup_timestamps removes zero time value if minimum is set to zero
Python version
Python 3.7 Asammdf 7.07
Code
MDF version
4.1
Code snippet
from asammdf import MDF, Signal
import numpy as np
timestamps = np.array([0,1,2,3,4])
data = np.random.rand(5)
mdf = MDF()
sig = Signal(name="test",timestamps=timestamps, samples=data)
mdf.append(sig)
mdf_cleaned = mdf.cleanup_timestamps(0, 10)
print(mdf_cleaned.select(["test"]))
"""
[<Signal test:
samples=[0.93248571 0.30446711 0.26117341 0.31794446]
timestamps=[1. 2. 3. 4.]
invalidation_bits=None
unit=""
conversion=None
source=None
comment=""
mastermeta="('time', 1)"
raw=False
display_names={}
attachment=None>
]
"""
Description
As shown in the example timestamps that start with zero will be removed if cleanup_timestamps(0, ...)
is called. From doing minimal debugging it seem like that >= minimum is called which should not remove the zero. However the log call to get the exponent obviously does not work with zero which may be the culprit here.
Using any non zero start value works as expected.
@muendlein please try the development branch code