Edgecase for t=0
This commit is contained in:
parent
b93d1863ec
commit
8a87f1fc6f
1 changed files with 2 additions and 5 deletions
|
|
@ -27,11 +27,8 @@ def to_signal(ts_mapping) -> DiscreteSignal:
|
||||||
def interp(sig, t, tag=None):
|
def interp(sig, t, tag=None):
|
||||||
# TODO: return function that interpolates the whole signal.
|
# TODO: return function that interpolates the whole signal.
|
||||||
sig = sig.project({tag})
|
sig = sig.project({tag})
|
||||||
idx = sig.data.bisect_right(t) - 1
|
idx = max(sig.data.bisect_right(t) - 1, 0)
|
||||||
if idx < 0:
|
key = sig.data.keys()[idx]
|
||||||
return None
|
|
||||||
else:
|
|
||||||
key = sig.data.keys()[idx]
|
|
||||||
return sig[key][tag]
|
return sig[key][tag]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue