Merge pull request #220 from Gaudeval/master

Fix negative time in signals following a timeshift
This commit is contained in:
Marcell Vazquez-Chanlatte 2020-08-12 10:03:13 -07:00 committed by GitHub
commit 21b8addad7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View file

@ -150,7 +150,8 @@ def eval_mtl_next(phi, dt):
f = eval_mtl(phi.arg, dt) f = eval_mtl(phi.arg, dt)
def _eval(x): def _eval(x):
return (f(x) << dt).retag({phi.arg: phi}) v = (f(x) << dt)
return v[max(v.start, 0):].retag({phi.arg: phi})
return _eval return _eval

View file

@ -11,3 +11,12 @@ def test_eval_regression_smoke1():
} }
f2 = mtl.parse('(a U[0,3] b)') f2 = mtl.parse('(a U[0,3] b)')
f2(d2, quantitative=False) f2(d2, quantitative=False)
def test_eval_regression_next_neg():
"""From issue #219"""
d = {"a": [(0, False), (1, True)]}
f = mtl.parse("(a & (X (~a)))")
v = f(d, quantitative=False, dt=1, time=None)
assert not f(d, quantitative=False, dt=1)
assert min(t for t, _ in v) >= 0