diff --git a/code/lib/lmdk_bgt.py b/code/lib/lmdk_bgt.py index b8e0b9f..1935d78 100644 --- a/code/lib/lmdk_bgt.py +++ b/code/lib/lmdk_bgt.py @@ -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