summaryrefslogtreecommitdiff
path: root/test/test_ptamodel.py
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2021-02-18 12:07:52 +0100
committerDaniel Friesel <daniel.friesel@uos.de>2021-02-18 12:07:52 +0100
commitc68c4a2bc617dd1356d5d0d2c3ee0ff9754261ab (patch)
tree20446fcd7ed1f8f4a88d112ef5f8573debf0ccd6 /test/test_ptamodel.py
parent45310b5f95dba00b1b6e2191309961c98ba9980c (diff)
refactor model generation from Analytic/PTAModel into ModelAttribute class
Iteration over states/transitions and model attributes is no longer hardcoded into most model generation code. This should make support for decision trees and sub-states much easier.
Diffstat (limited to 'test/test_ptamodel.py')
-rwxr-xr-xtest/test_ptamodel.py46
1 files changed, 34 insertions, 12 deletions
diff --git a/test/test_ptamodel.py b/test/test_ptamodel.py
index fb4f7e9..bcbb19a 100755
--- a/test/test_ptamodel.py
+++ b/test/test_ptamodel.py
@@ -567,54 +567,76 @@ class TestFromFile(unittest.TestCase):
self.assertAlmostEqual(static_model("write_nb", "duration"), 510, places=0)
self.assertAlmostEqual(
- model.stats.param_dependence_ratio("POWERDOWN", "power", "datarate"),
+ model.attr_by_name["POWERDOWN"]["power"].stats.param_dependence_ratio(
+ "datarate"
+ ),
0,
places=2,
)
self.assertAlmostEqual(
- model.stats.param_dependence_ratio("POWERDOWN", "power", "txbytes"),
+ model.attr_by_name["POWERDOWN"]["power"].stats.param_dependence_ratio(
+ "txbytes"
+ ),
0,
places=2,
)
self.assertAlmostEqual(
- model.stats.param_dependence_ratio("POWERDOWN", "power", "txpower"),
+ model.attr_by_name["POWERDOWN"]["power"].stats.param_dependence_ratio(
+ "txpower"
+ ),
0,
places=2,
)
self.assertAlmostEqual(
- model.stats.param_dependence_ratio("RX", "power", "datarate"),
+ model.attr_by_name["RX"]["power"].stats.param_dependence_ratio("datarate"),
0.99,
places=2,
)
self.assertAlmostEqual(
- model.stats.param_dependence_ratio("RX", "power", "txbytes"), 0, places=2
+ model.attr_by_name["RX"]["power"].stats.param_dependence_ratio("txbytes"),
+ 0,
+ places=2,
)
self.assertAlmostEqual(
- model.stats.param_dependence_ratio("RX", "power", "txpower"), 0.01, places=2
+ model.attr_by_name["RX"]["power"].stats.param_dependence_ratio("txpower"),
+ 0.01,
+ places=2,
)
self.assertAlmostEqual(
- model.stats.param_dependence_ratio("STANDBY1", "power", "datarate"),
+ model.attr_by_name["STANDBY1"]["power"].stats.param_dependence_ratio(
+ "datarate"
+ ),
0.04,
places=2,
)
self.assertAlmostEqual(
- model.stats.param_dependence_ratio("STANDBY1", "power", "txbytes"),
+ model.attr_by_name["STANDBY1"]["power"].stats.param_dependence_ratio(
+ "txbytes"
+ ),
0.35,
places=2,
)
self.assertAlmostEqual(
- model.stats.param_dependence_ratio("STANDBY1", "power", "txpower"),
+ model.attr_by_name["STANDBY1"]["power"].stats.param_dependence_ratio(
+ "txpower"
+ ),
0.32,
places=2,
)
self.assertAlmostEqual(
- model.stats.param_dependence_ratio("TX", "power", "datarate"), 1, places=2
+ model.attr_by_name["TX"]["power"].stats.param_dependence_ratio("datarate"),
+ 1,
+ places=2,
)
self.assertAlmostEqual(
- model.stats.param_dependence_ratio("TX", "power", "txbytes"), 0.09, places=2
+ model.attr_by_name["TX"]["power"].stats.param_dependence_ratio("txbytes"),
+ 0.09,
+ places=2,
)
self.assertAlmostEqual(
- model.stats.param_dependence_ratio("TX", "power", "txpower"), 1, places=2
+ model.attr_by_name["TX"]["power"].stats.param_dependence_ratio("txpower"),
+ 1,
+ places=2,
)
param_model, param_info = model.get_fitted()