diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/analyze-archive.py | 24 | ||||
-rwxr-xr-x | bin/test.py | 24 |
2 files changed, 24 insertions, 24 deletions
diff --git a/bin/analyze-archive.py b/bin/analyze-archive.py index f203038..dbfe0d1 100755 --- a/bin/analyze-archive.py +++ b/bin/analyze-archive.py @@ -79,17 +79,17 @@ def print_text_model_data(model, pm, pq, lm, lq, am, ai, aq): print(r'key attribute $1 - \frac{\sigma_X}{...}$') for state_or_tran in model.by_name.keys(): for attribute in model.attributes(state_or_tran): - print('{} {} {:.8f}'.format(state_or_tran, attribute, model.generic_param_dependence_ratio(state_or_tran, attribute))) + print('{} {} {:.8f}'.format(state_or_tran, attribute, model.stats.generic_param_dependence_ratio(state_or_tran, attribute))) print('') print(r'key attribute parameter $1 - \frac{...}{...}$') for state_or_tran in model.by_name.keys(): for attribute in model.attributes(state_or_tran): for param in model.parameters(): - print('{} {} {} {:.8f}'.format(state_or_tran, attribute, param, model.param_dependence_ratio(state_or_tran, attribute, param))) + print('{} {} {} {:.8f}'.format(state_or_tran, attribute, param, model.stats.param_dependence_ratio(state_or_tran, attribute, param))) if state_or_tran in model._num_args: for arg_index in range(model._num_args[state_or_tran]): - print('{} {} {:d} {:.8f}'.format(state_or_tran, attribute, arg_index, model.arg_dependence_ratio(state_or_tran, attribute, arg_index))) + print('{} {} {:d} {:.8f}'.format(state_or_tran, attribute, arg_index, model.stats.arg_dependence_ratio(state_or_tran, attribute, arg_index))) if __name__ == '__main__': @@ -168,20 +168,20 @@ if __name__ == '__main__': print('{:10s}: {:.0f} µW ({:.2f})'.format( state, static_model(state, 'power'), - model.generic_param_dependence_ratio(state, 'power'))) + model.stats.generic_param_dependence_ratio(state, 'power'))) for param in model.parameters(): print('{:10s} dependence on {:15s}: {:.2f}'.format( '', param, - model.param_dependence_ratio(state, 'power', param))) + model.stats.param_dependence_ratio(state, 'power', param))) for trans in model.transitions(): print('{:10s}: {:.0f} / {:.0f} / {:.0f} pJ ({:.2f} / {:.2f} / {:.2f})'.format( trans, static_model(trans, 'energy'), static_model(trans, 'rel_energy_prev'), static_model(trans, 'rel_energy_next'), - model.generic_param_dependence_ratio(trans, 'energy'), - model.generic_param_dependence_ratio(trans, 'rel_energy_prev'), - model.generic_param_dependence_ratio(trans, 'rel_energy_next'))) + model.stats.generic_param_dependence_ratio(trans, 'energy'), + model.stats.generic_param_dependence_ratio(trans, 'rel_energy_prev'), + model.stats.generic_param_dependence_ratio(trans, 'rel_energy_next'))) print('{:10s}: {:.0f} µs'.format(trans, static_model(trans, 'duration'))) static_quality = model.assess(static_model) @@ -200,14 +200,14 @@ if __name__ == '__main__': for attribute in model.attributes(state): info = param_info(state, attribute) print('{:10s} {:10s} non-param stddev {:f}'.format( - state, attribute, model.stats[state][attribute]['std_static'] + state, attribute, model.stats.stats[state][attribute]['std_static'] )) print('{:10s} {:10s} param-lut stddev {:f}'.format( - state, attribute, model.stats[state][attribute]['std_param_lut'] + state, attribute, model.stats.stats[state][attribute]['std_param_lut'] )) - for param in sorted(model.stats[state][attribute]['std_by_param'].keys()): + for param in sorted(model.stats.stats[state][attribute]['std_by_param'].keys()): print('{:10s} {:10s} {:10s} stddev {:f}'.format( - state, attribute, param, model.stats[state][attribute]['std_by_param'][param] + state, attribute, param, model.stats.stats[state][attribute]['std_by_param'][param] )) if info != None: for param_name in sorted(info['fit_result'].keys(), key=str): diff --git a/bin/test.py b/bin/test.py index 433b423..0b015f4 100755 --- a/bin/test.py +++ b/bin/test.py @@ -43,18 +43,18 @@ class TestStaticModel(unittest.TestCase): self.assertAlmostEqual(static_model('stopListening', 'duration'), 260, places=0) self.assertAlmostEqual(static_model('write_nb', 'duration'), 510, places=0) - self.assertAlmostEqual(model.param_dependence_ratio('POWERDOWN', 'power', 'datarate'), 0, places=2) - self.assertAlmostEqual(model.param_dependence_ratio('POWERDOWN', 'power', 'txbytes'), 0, places=2) - self.assertAlmostEqual(model.param_dependence_ratio('POWERDOWN', 'power', 'txpower'), 0, places=2) - self.assertAlmostEqual(model.param_dependence_ratio('RX', 'power', 'datarate'), 0.99, places=2) - self.assertAlmostEqual(model.param_dependence_ratio('RX', 'power', 'txbytes'), 0, places=2) - self.assertAlmostEqual(model.param_dependence_ratio('RX', 'power', 'txpower'), 0.01, places=2) - self.assertAlmostEqual(model.param_dependence_ratio('STANDBY1', 'power', 'datarate'), 0.04, places=2) - self.assertAlmostEqual(model.param_dependence_ratio('STANDBY1', 'power', 'txbytes'), 0.35, places=2) - self.assertAlmostEqual(model.param_dependence_ratio('STANDBY1', 'power', 'txpower'), 0.32, places=2) - self.assertAlmostEqual(model.param_dependence_ratio('TX', 'power', 'datarate'), 1, places=2) - self.assertAlmostEqual(model.param_dependence_ratio('TX', 'power', 'txbytes'), 0.09, places=2) - self.assertAlmostEqual(model.param_dependence_ratio('TX', 'power', 'txpower'), 1, places=2) + self.assertAlmostEqual(model.stats.param_dependence_ratio('POWERDOWN', 'power', 'datarate'), 0, places=2) + self.assertAlmostEqual(model.stats.param_dependence_ratio('POWERDOWN', 'power', 'txbytes'), 0, places=2) + self.assertAlmostEqual(model.stats.param_dependence_ratio('POWERDOWN', 'power', 'txpower'), 0, places=2) + self.assertAlmostEqual(model.stats.param_dependence_ratio('RX', 'power', 'datarate'), 0.99, places=2) + self.assertAlmostEqual(model.stats.param_dependence_ratio('RX', 'power', 'txbytes'), 0, places=2) + self.assertAlmostEqual(model.stats.param_dependence_ratio('RX', 'power', 'txpower'), 0.01, places=2) + self.assertAlmostEqual(model.stats.param_dependence_ratio('STANDBY1', 'power', 'datarate'), 0.04, places=2) + self.assertAlmostEqual(model.stats.param_dependence_ratio('STANDBY1', 'power', 'txbytes'), 0.35, places=2) + self.assertAlmostEqual(model.stats.param_dependence_ratio('STANDBY1', 'power', 'txpower'), 0.32, places=2) + self.assertAlmostEqual(model.stats.param_dependence_ratio('TX', 'power', 'datarate'), 1, places=2) + self.assertAlmostEqual(model.stats.param_dependence_ratio('TX', 'power', 'txbytes'), 0.09, places=2) + self.assertAlmostEqual(model.stats.param_dependence_ratio('TX', 'power', 'txpower'), 1, places=2) param_model, param_info = model.get_fitted() self.assertEqual(param_info('POWERDOWN', 'power'), None) |