lmdk_bgt.discount: Dealing with zero

This commit is contained in:
Manos Katsomallos 2021-07-26 18:11:48 +03:00
parent 96a1178c09
commit b1b4a11d39

View File

@ -442,9 +442,12 @@ def discount(seq, lmdks, epsilon):
lmdk_cur = 0
# Track skipped releases
skipped = 0
# Initialize the sampling rate
samp_rt = .5
for i, p in enumerate(seq):
# The sampling rate
samp_rt = datetime.fromtimestamp(int(lmdks[lmdk_cur][3]))/datetime.fromtimestamp(int(lmdks[len(lmdks) - 1][3]))
# Adjust the sampling rate
if lmdks:
samp_rt = datetime.fromtimestamp(int(lmdks[lmdk_cur][3]))/datetime.fromtimestamp(int(lmdks[len(lmdks) - 1][3]))
# Check if current point is a landmark
if lmdk_lib.is_landmark(p, lmdks):
lmdk_cur += 1