removed robustess calculations + finish porting to traces library
This commit is contained in:
parent
3a7ac439f1
commit
4871f993c0
5 changed files with 6 additions and 282 deletions
|
|
@ -1,7 +1,6 @@
|
|||
import stl
|
||||
import stl.robustness
|
||||
import stl.synth
|
||||
import pandas as pd
|
||||
import traces
|
||||
from nose2.tools import params
|
||||
import unittest
|
||||
from sympy import Symbol
|
||||
|
|
@ -20,8 +19,11 @@ ex5 = ("F[0, b?](A > 0)", ("b?",), {"b?": (0.1, 5)},
|
|||
ex6 = ("(A > a?) or (A > b?)", ("a?", "b?",), {"a?": (0, 2), "b?": (0, 2)},
|
||||
{"a?": False, "b?": False}, {"a?": 2, "b?": 1})
|
||||
|
||||
x = pd.DataFrame([[1,2], [1,4], [4,2]], index=[0,0.1,0.2],
|
||||
columns=["A", "B"])
|
||||
x = {
|
||||
"A": traces.TimeSeries([(0, 1), (0.1, 1), (0.2, 4)]),
|
||||
"B": traces.TimeSeries([(0, 2), (0.1, 4), (0.2, 2)]),
|
||||
"C": traces.TimeSeries([(0, True), (0.1, True), (0.2, False)]),
|
||||
}
|
||||
|
||||
|
||||
class TestSTLRobustness(unittest.TestCase):
|
||||
|
|
@ -31,15 +33,6 @@ class TestSTLRobustness(unittest.TestCase):
|
|||
val2 = stl.synth.lex_param_project(
|
||||
phi, x, order=order, ranges=ranges, polarity=polarity)
|
||||
|
||||
phi2 = stl.utils.set_params(phi, val2)
|
||||
phi3 = stl.utils.set_params(phi, val)
|
||||
|
||||
stl_eval = stl.robustness.pointwise_robustness(phi2)
|
||||
stl_eval2 = stl.robustness.pointwise_robustness(phi3)
|
||||
|
||||
# check that the robustnesses are almost the same
|
||||
self.assertAlmostEqual(stl_eval(x, 0), stl_eval2(x, 0), delta=0.01)
|
||||
|
||||
# check that the valuations are almost the same
|
||||
for var in order:
|
||||
self.assertAlmostEqual(val2[var], val[var], delta=0.01)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue