start switch to traces from pandas

This commit is contained in:
Marcell Vazquez-Chanlatte 2017-04-23 12:42:57 -07:00
parent b28898820e
commit e477392664
6 changed files with 55 additions and 20 deletions

View file

@ -1,13 +1,15 @@
import stl
import stl.boolean_eval
import stl.fastboolean_eval
import pandas as pd
import traces
from nose2.tools import params
import unittest
from sympy import Symbol
ex1 = ("2*A > 3", False)
ex2 = ("F[0, 1](2*A > 3)", True)
ex2 = ("F(2*A > 3)", True)
ex2 = ("F[0, inf](2*A > 3)", True)
ex3 = ("F[1, 0](2*A > 3)", False)
ex4 = ("G[1, 0](2*A > 3)", True)
ex5 = ("(A < 0)", False)
@ -17,8 +19,11 @@ ex8 = ("G[0, 0.2](C)", False)
ex9 = ("(F[0, 0.2](C)) and (F[0, 1](2*A > 3))", True)
ex10 = ("(A = 1) U (A = 4)", True)
ex11 = ("(A < 5) U (A = 4)", False)
x = pd.DataFrame([[1,2, True], [1,4, True], [4,2, False]], index=[0,0.1,0.2],
columns=["A", "B", "C"])
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 TestSTLEval(unittest.TestCase):
@params(ex1, ex2, ex3, ex4, ex5, ex6, ex7, ex8, ex9, ex10, ex11)
@ -30,7 +35,7 @@ class TestSTLEval(unittest.TestCase):
self.assertEqual(stl_eval2(x, 0), not r)
"""
@params(ex1, ex2, ex3, ex4, ex5, ex6, ex7, ex8, ex9, ex10, ex11)
def test_fasteval(self, phi_str, _):
phi = stl.parse(phi_str)
@ -43,3 +48,4 @@ class TestSTLEval(unittest.TestCase):
b_fast2 = stl_evalf2(x, 0)
self.assertEqual(b_slow, b_fast)
self.assertEqual(b_fast, not b_fast2)
"""