add set_time to game_to_sl
This commit is contained in:
parent
70d8ae7e9a
commit
41ccd20a6e
2 changed files with 4 additions and 7 deletions
|
|
@ -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 dt_sym, t_sym
|
||||||
from stl.stl import LinEq, Var, Interval, NaryOpSTL, Or, And, F, G, ModalOp, Neg
|
from stl.stl import LinEq, Var, Interval, NaryOpSTL, Or, And, F, G, ModalOp, Neg
|
||||||
from stl.parser import parse
|
from stl.parser import parse
|
||||||
|
|
|
||||||
9
stl.py
9
stl.py
|
|
@ -102,8 +102,9 @@ def tree(stl):
|
||||||
return {x:set(x.children()) for x in walk(stl) if x.children()}
|
return {x:set(x.children()) for x in walk(stl) if x.children()}
|
||||||
|
|
||||||
|
|
||||||
def time_lens(phi:"STL") -> lens:
|
def time_lens(phi:"STL", bind=True) -> lens:
|
||||||
return _time_lens(phi).bind(phi)
|
l = _time_lens(phi)
|
||||||
|
return l.bind(phi) if bind else l
|
||||||
|
|
||||||
|
|
||||||
def _time_lens(phi):
|
def _time_lens(phi):
|
||||||
|
|
@ -116,7 +117,3 @@ def _time_lens(phi):
|
||||||
return lens().args.tuple_(*child_lens).each_()
|
return lens().args.tuple_(*child_lens).each_()
|
||||||
else:
|
else:
|
||||||
return lens().arg.add_lens(_time_lens(phi.arg))
|
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})
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue