summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/analyze-archive.py8
-rwxr-xr-xbin/test.py8
2 files changed, 14 insertions, 2 deletions
diff --git a/bin/analyze-archive.py b/bin/analyze-archive.py
index 032c7ca..cf3449a 100755
--- a/bin/analyze-archive.py
+++ b/bin/analyze-archive.py
@@ -9,9 +9,9 @@ if __name__ == '__main__':
preprocessed_data = raw_data.get_preprocessed_data()
model = EnergyModel(preprocessed_data)
- static_model = model.get_static()
print('--- simple static model ---')
+ static_model = model.get_static()
for state in model.states():
print('{:10s}: {:.0f} µW'.format(state, static_model(state, 'power')))
for trans in model.transitions():
@@ -20,6 +20,10 @@ if __name__ == '__main__':
static_model(trans, 'rel_energy_prev'),
static_model(trans, 'rel_energy_next')))
print('{:10s}: {:.0f} µs'.format(trans, static_model(trans, 'duration')))
+ model.assess(static_model)
+
+ print('--- LUT ---')
+ lut_model = model.get_param_lut()
+ model.assess(lut_model)
- model.assess(model.get_static())
sys.exit(0)
diff --git a/bin/test.py b/bin/test.py
index 6ac9942..71c02bd 100755
--- a/bin/test.py
+++ b/bin/test.py
@@ -60,6 +60,14 @@ class TestStaticModel(unittest.TestCase):
self.assertAlmostEqual(static_model('off', 'duration'), 9130, places=0)
self.assertAlmostEqual(static_model('setBrightness', 'duration'), 9130, places=0)
+ param_lut_model = model.get_param_lut()
+ self.assertAlmostEqual(param_lut_model('OFF', 'power', param=[None, None]), 7124, places=0)
+ with self.assertRaises(KeyError):
+ param_lut_model('ON', 'power', param=[None, None])
+ param_lut_model('ON', 'power', param=['a'])
+ param_lut_model('ON', 'power', param=[0])
+ self.assertTrue(param_lut_model('ON', 'power', param=[0, 0]))
+
def test_model_multifile_lm75x(self):
testfiles = [
'../data/20170116_124500_LM75x.tar',