summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/test_ptamodel.py40
-rwxr-xr-xtest/test_timingharness.py56
2 files changed, 45 insertions, 51 deletions
diff --git a/test/test_ptamodel.py b/test/test_ptamodel.py
index e571dcc..9f5076c 100755
--- a/test/test_ptamodel.py
+++ b/test/test_ptamodel.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-from dfatool.functions import StaticInfo
+from dfatool.functions import StaticFunction
from dfatool.loader import RawData, pta_trace_to_aggregate
from dfatool.model import PTAModel
from dfatool.utils import by_name_to_by_param
@@ -639,28 +639,26 @@ class TestFromFile(unittest.TestCase):
)
param_model, param_info = model.get_fitted()
- self.assertIsInstance(param_info("POWERDOWN", "power"), StaticInfo)
+ self.assertIsInstance(param_info("POWERDOWN", "power"), StaticFunction)
self.assertEqual(
- param_info("RX", "power").function.model_function,
+ param_info("RX", "power").model_function,
"0 + regression_arg(0) + regression_arg(1) * np.sqrt(parameter(datarate))",
)
self.assertAlmostEqual(
- param_info("RX", "power").function.model_args[0], 48530.7, places=0
+ param_info("RX", "power").model_args[0], 48530.7, places=0
)
- self.assertAlmostEqual(
- param_info("RX", "power").function.model_args[1], 117, places=0
- )
- self.assertIsInstance(param_info("STANDBY1", "power"), StaticInfo)
+ self.assertAlmostEqual(param_info("RX", "power").model_args[1], 117, places=0)
+ self.assertIsInstance(param_info("STANDBY1", "power"), StaticFunction)
self.assertEqual(
- param_info("TX", "power").function.model_function,
+ param_info("TX", "power").model_function,
"0 + regression_arg(0) + regression_arg(1) * 1/(parameter(datarate)) + regression_arg(2) * parameter(txpower) + regression_arg(3) * 1/(parameter(datarate)) * parameter(txpower)",
)
self.assertEqual(
- param_info("epilogue", "timeout").function.model_function,
+ param_info("epilogue", "timeout").model_function,
"0 + regression_arg(0) + regression_arg(1) * 1/(parameter(datarate))",
)
self.assertEqual(
- param_info("stopListening", "duration").function.model_function,
+ param_info("stopListening", "duration").model_function,
"0 + regression_arg(0) + regression_arg(1) * 1/(parameter(datarate))",
)
@@ -1823,22 +1821,18 @@ class TestFromFile(unittest.TestCase):
"""
param_model, param_info = model.get_fitted()
- self.assertIsInstance(param_info("IDLE", "power"), StaticInfo)
+ self.assertIsInstance(param_info("IDLE", "power"), StaticFunction)
self.assertEqual(
- param_info("RX", "power").function.model_function,
+ param_info("RX", "power").model_function,
"0 + regression_arg(0) + regression_arg(1) * np.log(parameter(symbolrate) + 1)",
)
- self.assertIsInstance(param_info("SLEEP", "power"), StaticInfo)
- self.assertIsInstance(param_info("SLEEP_EWOR", "power"), StaticInfo)
- self.assertIsInstance(param_info("SYNTH_ON", "power"), StaticInfo)
- self.assertIsInstance(param_info("XOFF", "power"), StaticInfo)
+ self.assertIsInstance(param_info("SLEEP", "power"), StaticFunction)
+ self.assertIsInstance(param_info("SLEEP_EWOR", "power"), StaticFunction)
+ self.assertIsInstance(param_info("SYNTH_ON", "power"), StaticFunction)
+ self.assertIsInstance(param_info("XOFF", "power"), StaticFunction)
- self.assertAlmostEqual(
- param_info("RX", "power").function.model_args[0], 84415, places=0
- )
- self.assertAlmostEqual(
- param_info("RX", "power").function.model_args[1], 206, places=0
- )
+ self.assertAlmostEqual(param_info("RX", "power").model_args[0], 84415, places=0)
+ self.assertAlmostEqual(param_info("RX", "power").model_args[1], 206, places=0)
if __name__ == "__main__":
diff --git a/test/test_timingharness.py b/test/test_timingharness.py
index 8c68e4a..06edc16 100755
--- a/test/test_timingharness.py
+++ b/test/test_timingharness.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-from dfatool.functions import StaticInfo
+from dfatool.functions import StaticFunction
from dfatool.loader import TimingData, pta_trace_to_aggregate
from dfatool.model import AnalyticModel
from dfatool.parameters import prune_dependent_parameters
@@ -31,25 +31,25 @@ class TestModels(unittest.TestCase):
)
param_model, param_info = model.get_fitted()
- self.assertIsInstance(param_info("setPALevel", "duration"), StaticInfo)
- self.assertIsInstance(param_info("setRetries", "duration"), StaticInfo)
- self.assertIsInstance(param_info("setup", "duration"), StaticInfo)
+ self.assertIsInstance(param_info("setPALevel", "duration"), StaticFunction)
+ self.assertIsInstance(param_info("setRetries", "duration"), StaticFunction)
+ self.assertIsInstance(param_info("setup", "duration"), StaticFunction)
self.assertEqual(
- param_info("write", "duration").function.model_function,
+ param_info("write", "duration").model_function,
"0 + regression_arg(0) + regression_arg(1) * parameter(max_retry_count) + regression_arg(2) * parameter(retry_delay) + regression_arg(3) * parameter(max_retry_count) * parameter(retry_delay)",
)
self.assertAlmostEqual(
- param_info("write", "duration").function.model_args[0], 1163, places=0
+ param_info("write", "duration").model_args[0], 1163, places=0
)
self.assertAlmostEqual(
- param_info("write", "duration").function.model_args[1], 464, places=0
+ param_info("write", "duration").model_args[1], 464, places=0
)
self.assertAlmostEqual(
- param_info("write", "duration").function.model_args[2], 1, places=0
+ param_info("write", "duration").model_args[2], 1, places=0
)
self.assertAlmostEqual(
- param_info("write", "duration").function.model_args[3], 1, places=0
+ param_info("write", "duration").model_args[3], 1, places=0
)
def test_dependent_parameter_pruning(self):
@@ -78,26 +78,26 @@ class TestModels(unittest.TestCase):
)
param_model, param_info = model.get_fitted()
- self.assertIsInstance(param_info("getObserveTx", "duration"), StaticInfo)
- self.assertIsInstance(param_info("setPALevel", "duration"), StaticInfo)
- self.assertIsInstance(param_info("setRetries", "duration"), StaticInfo)
- self.assertIsInstance(param_info("setup", "duration"), StaticInfo)
+ self.assertIsInstance(param_info("getObserveTx", "duration"), StaticFunction)
+ self.assertIsInstance(param_info("setPALevel", "duration"), StaticFunction)
+ self.assertIsInstance(param_info("setRetries", "duration"), StaticFunction)
+ self.assertIsInstance(param_info("setup", "duration"), StaticFunction)
self.assertEqual(
- param_info("write", "duration").function.model_function,
+ param_info("write", "duration").model_function,
"0 + regression_arg(0) + regression_arg(1) * parameter(max_retry_count) + regression_arg(2) * parameter(retry_delay) + regression_arg(3) * parameter(max_retry_count) * parameter(retry_delay)",
)
self.assertAlmostEqual(
- param_info("write", "duration").function.model_args[0], 1163, places=0
+ param_info("write", "duration").model_args[0], 1163, places=0
)
self.assertAlmostEqual(
- param_info("write", "duration").function.model_args[1], 464, places=0
+ param_info("write", "duration").model_args[1], 464, places=0
)
self.assertAlmostEqual(
- param_info("write", "duration").function.model_args[2], 1, places=0
+ param_info("write", "duration").model_args[2], 1, places=0
)
self.assertAlmostEqual(
- param_info("write", "duration").function.model_args[3], 1, places=0
+ param_info("write", "duration").model_args[3], 1, places=0
)
def test_function_override(self):
@@ -136,29 +136,29 @@ class TestModels(unittest.TestCase):
)
param_model, param_info = model.get_fitted()
- self.assertIsInstance(param_info("setAutoAck", "duration"), StaticInfo)
- self.assertIsInstance(param_info("setPALevel", "duration"), StaticInfo)
- self.assertIsInstance(param_info("setRetries", "duration"), StaticInfo)
- self.assertIsInstance(param_info("setup", "duration"), StaticInfo)
+ self.assertIsInstance(param_info("setAutoAck", "duration"), StaticFunction)
+ self.assertIsInstance(param_info("setPALevel", "duration"), StaticFunction)
+ self.assertIsInstance(param_info("setRetries", "duration"), StaticFunction)
+ self.assertIsInstance(param_info("setup", "duration"), StaticFunction)
self.assertEqual(
- param_info("write", "duration").function.model_function,
+ param_info("write", "duration").model_function,
"(parameter(auto_ack!) * (regression_arg(0) + regression_arg(1) * parameter(max_retry_count) + regression_arg(2) * parameter(retry_delay) + regression_arg(3) * parameter(max_retry_count) * parameter(retry_delay))) + ((1 - parameter(auto_ack!)) * regression_arg(4))",
)
self.assertAlmostEqual(
- param_info("write", "duration").function.model_args[0], 1162, places=0
+ param_info("write", "duration").model_args[0], 1162, places=0
)
self.assertAlmostEqual(
- param_info("write", "duration").function.model_args[1], 464, places=0
+ param_info("write", "duration").model_args[1], 464, places=0
)
self.assertAlmostEqual(
- param_info("write", "duration").function.model_args[2], 1, places=0
+ param_info("write", "duration").model_args[2], 1, places=0
)
self.assertAlmostEqual(
- param_info("write", "duration").function.model_args[3], 1, places=0
+ param_info("write", "duration").model_args[3], 1, places=0
)
self.assertAlmostEqual(
- param_info("write", "duration").function.model_args[4], 1086, places=0
+ param_info("write", "duration").model_args[4], 1086, places=0
)
os.environ.pop("DFATOOL_NO_DECISIONTREES")