summaryrefslogtreecommitdiff
path: root/bin/test.py
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-02-08 10:15:09 +0100
committerDaniel Friesel <derf@finalrewind.org>2019-02-08 10:15:40 +0100
commit2db31a8adac549f2bdc1d2c204b16bc2f815eff3 (patch)
tree7a338d405e5f9a338c0ee0fa1afbd8b4283a7c5d /bin/test.py
parent2b479dc993b1d73d236d96a4d57bb69159b1603e (diff)
Convert PTAModel to EnergyModel signature
outlier detection / removal is not supported at the moment.
Diffstat (limited to 'bin/test.py')
-rwxr-xr-xbin/test.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/bin/test.py b/bin/test.py
index ae72df2..f53a9ef 100755
--- a/bin/test.py
+++ b/bin/test.py
@@ -1,13 +1,14 @@
#!/usr/bin/env python3
-from dfatool import PTAModel, RawData, analytic
+from dfatool import PTAModel, RawData, pta_trace_to_aggregate
import unittest
class TestStaticModel(unittest.TestCase):
def test_model_singlefile_rf24(self):
raw_data = RawData(['../data/20170220_164723_RF24_int_A.tar'])
preprocessed_data = raw_data.get_preprocessed_data(verbose = False)
- model = PTAModel(preprocessed_data, verbose = False)
+ by_name, parameters, arg_count = pta_trace_to_aggregate(preprocessed_data)
+ model = PTAModel(by_name, parameters, arg_count, verbose = False)
self.assertEqual(model.states(), 'POWERDOWN RX STANDBY1 TX'.split(' '))
self.assertEqual(model.transitions(), 'begin epilogue powerDown powerUp setDataRate_num setPALevel_num startListening stopListening write_nb'.split(' '))
static_model = model.get_static()
@@ -72,7 +73,8 @@ class TestStaticModel(unittest.TestCase):
def test_model_singlefile_mmparam(self):
raw_data = RawData(['../data/20161221_123347_mmparam.tar'])
preprocessed_data = raw_data.get_preprocessed_data(verbose = False)
- model = PTAModel(preprocessed_data, verbose = False)
+ by_name, parameters, arg_count = pta_trace_to_aggregate(preprocessed_data)
+ model = PTAModel(by_name, parameters, arg_count, verbose = False)
self.assertEqual(model.states(), 'OFF ON'.split(' '))
self.assertEqual(model.transitions(), 'off setBrightness'.split(' '))
static_model = model.get_static()
@@ -100,7 +102,8 @@ class TestStaticModel(unittest.TestCase):
]
raw_data = RawData(testfiles)
preprocessed_data = raw_data.get_preprocessed_data(verbose = False)
- model = PTAModel(preprocessed_data, verbose = False)
+ by_name, parameters, arg_count = pta_trace_to_aggregate(preprocessed_data)
+ model = PTAModel(by_name, parameters, arg_count, verbose = False)
self.assertEqual(model.states(), 'ACTIVE POWEROFF'.split(' '))
self.assertEqual(model.transitions(), 'getTemp setHyst setOS shutdown start'.split(' '))
static_model = model.get_static()
@@ -129,7 +132,8 @@ class TestStaticModel(unittest.TestCase):
]
raw_data = RawData(testfiles)
preprocessed_data = raw_data.get_preprocessed_data(verbose = False)
- model = PTAModel(preprocessed_data, verbose = False)
+ by_name, parameters, arg_count = pta_trace_to_aggregate(preprocessed_data)
+ model = PTAModel(by_name, parameters, arg_count, verbose = False)
self.assertEqual(model.states(), 'DISABLED ENABLED'.split(' '))
self.assertEqual(model.transitions(), 'clear disable enable ioInit sendLine toggleVCOM'.split(' '))
static_model = model.get_static()
@@ -161,7 +165,8 @@ class TestStaticModel(unittest.TestCase):
]
raw_data = RawData(testfiles)
preprocessed_data = raw_data.get_preprocessed_data(verbose = False)
- model = PTAModel(preprocessed_data, verbose = False)
+ by_name, parameters, arg_count = pta_trace_to_aggregate(preprocessed_data)
+ model = PTAModel(by_name, parameters, arg_count, verbose = False)
self.assertEqual(model.states(), 'B G OFF R'.split(' '))
self.assertEqual(model.transitions(), 'blue green off red'.split(' '))
static_model = model.get_static()
@@ -193,7 +198,8 @@ class TestStaticModel(unittest.TestCase):
]
raw_data = RawData(testfiles)
preprocessed_data = raw_data.get_preprocessed_data(verbose = False)
- model = PTAModel(preprocessed_data, verbose = False)
+ by_name, parameters, arg_count = pta_trace_to_aggregate(preprocessed_data)
+ model = PTAModel(by_name, parameters, arg_count, verbose = False)
self.assertEqual(model.states(), 'IDLE RX SLEEP SLEEP_EWOR SYNTH_ON TX XOFF'.split(' '))
self.assertEqual(model.transitions(), 'crystal_off eWOR idle init prepare_xmit receive send setSymbolRate setTxPower sleep txDone'.split(' '))
static_model = model.get_static()
@@ -229,5 +235,4 @@ class TestStaticModel(unittest.TestCase):
self.assertAlmostEqual(param_info('RX', 'power')['function']._regression_args[1], 206, places=0)
if __name__ == '__main__':
- analytic.safe_function_enabled = False
unittest.main()