From 94622c2c44cc466a3c4137be8d35024fe1543a47 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 25 Jan 2018 20:57:19 +0100 Subject: print model data, assess model quality --- bin/analyze-archive.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'bin') diff --git a/bin/analyze-archive.py b/bin/analyze-archive.py index a2596d3..fcfb139 100755 --- a/bin/analyze-archive.py +++ b/bin/analyze-archive.py @@ -7,20 +7,24 @@ from scipy.cluster.vq import kmeans2 import struct import sys import tarfile -from dfatool import Analysis, RawData +from dfatool import EnergyModel, RawData if __name__ == '__main__': filename = sys.argv[1] raw_data = RawData(filename) preprocessed_data = raw_data.get_preprocessed_data() - print(preprocessed_data) - foo = Analysis(preprocessed_data) - res = foo.analyze() - print(res) - for key in res.keys(): - print(key) - for subkey in res[key].keys(): - if subkey != 'isa' and len(res[key][subkey]) > 0: - print(' {:s}: {:f}'.format(subkey, np.mean(res[key][subkey]))) + model = EnergyModel(preprocessed_data) + static_model = model.get_static() + + print('--- simple static model ---') + for state in model.states(): + print('{:10s}: {:.0f} µW'.format(state, static_model(state, 'power'))) + for trans in model.transitions(): + print('{:10s}: {:.0f} / {:.0f} / {:.0f} pJ'.format( + trans, static_model(trans, 'energy'), + static_model(trans, 'rel_energy_prev'), + static_model(trans, 'rel_energy_next'))) + + model.assess(model.get_static()) sys.exit(0) -- cgit v1.2.3