Skip to content

Commit

Permalink
Edgecase for t=0
Browse files Browse the repository at this point in the history
  • Loading branch information
mvcisback committed Sep 1, 2020
1 parent b93d186 commit 8a87f1f
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions mtl/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,8 @@ def to_signal(ts_mapping) -> DiscreteSignal:
def interp(sig, t, tag=None):
# TODO: return function that interpolates the whole signal.
sig = sig.project({tag})
idx = sig.data.bisect_right(t) - 1
if idx < 0:
return None
else:
key = sig.data.keys()[idx]
idx = max(sig.data.bisect_right(t) - 1, 0)
key = sig.data.keys()[idx]
return sig[key][tag]


Expand Down

0 comments on commit 8a87f1f

Please sign in to comment.