Edgecase for t=0
This commit is contained in:
parent
b93d1863ec
commit
8a87f1fc6f
1 changed files with 2 additions and 5 deletions
|
|
@ -27,10 +27,7 @@ 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:
|
||||
idx = max(sig.data.bisect_right(t) - 1, 0)
|
||||
key = sig.data.keys()[idx]
|
||||
return sig[key][tag]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue