add set_time to game_to_sl

This commit is contained in:
Marcell Vazquez-Chanlatte 2016-07-09 00:39:58 -07:00
parent 70d8ae7e9a
commit 41ccd20a6e
2 changed files with 4 additions and 7 deletions

View file

@ -1,4 +1,4 @@
from stl.stl import time_lens, set_time, walk, tree
from stl.stl import time_lens, walk, tree
from stl.stl import dt_sym, t_sym
from stl.stl import LinEq, Var, Interval, NaryOpSTL, Or, And, F, G, ModalOp, Neg
from stl.parser import parse

9
stl.py
View file

@ -102,8 +102,9 @@ def tree(stl):
return {x:set(x.children()) for x in walk(stl) if x.children()}
def time_lens(phi:"STL") -> lens:
return _time_lens(phi).bind(phi)
def time_lens(phi:"STL", bind=True) -> lens:
l = _time_lens(phi)
return l.bind(phi) if bind else l
def _time_lens(phi):
@ -116,7 +117,3 @@ def _time_lens(phi):
return lens().args.tuple_(*child_lens).each_()
else:
return lens().arg.add_lens(_time_lens(phi.arg))
def set_time(phi, *, t, dt=0.1):
return time_lens(phi).call("evalf", subs={t_sym: t, dt_sym: dt})