Merge pull request #125 from jpk15211/hotfix/start-times
Addressed mishandling of starting time values, Issue #107
This commit is contained in:
commit
8b85376e9b
2 changed files with 9 additions and 2 deletions
|
|
@ -42,7 +42,7 @@ def _neg(exp):
|
|||
return Neg(exp)
|
||||
|
||||
|
||||
def _eval(exp, trace, time=0, *, dt=0.1, quantitative=True):
|
||||
def _eval(exp, trace, time=False, *, dt=0.1, quantitative=True):
|
||||
from mtl import evaluator
|
||||
return evaluator.pointwise_sat(exp, dt)(trace, time, quantitative)
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,11 @@ def to_signal(ts_mapping):
|
|||
def interp(sig, t, tag=None):
|
||||
# TODO: return function that interpolates the whole signal.
|
||||
sig = sig.project({tag})
|
||||
key = sig.data.keys()[sig.data.bisect_right(t) - 1]
|
||||
idx = sig.data.bisect_right(t) - 1
|
||||
if idx<0:
|
||||
return None
|
||||
else:
|
||||
key = sig.data.keys()[idx]
|
||||
return sig[key][tag]
|
||||
|
||||
|
||||
|
|
@ -61,6 +65,9 @@ def pointwise_sat(phi, dt=0.1):
|
|||
res = [(t, v[phi]) for t, v in f(sig).items()]
|
||||
return res if quantitative else [((t, v > 0) for t, v in res)]
|
||||
|
||||
if t is False:
|
||||
t = f(sig).items()[0][0]
|
||||
|
||||
res = interp(f(sig), t, phi)
|
||||
return res if quantitative else res > 0
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue