From 3642def010396d46757fb2bc19445c45f9db1c55 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 11 Dec 2019 11:23:40 +0100 Subject: move PTA simulation result to separate class --- lib/automata.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'lib/automata.py') diff --git a/lib/automata.py b/lib/automata.py index 6ace61f..eb52081 100755 --- a/lib/automata.py +++ b/lib/automata.py @@ -13,6 +13,15 @@ def _dict_to_list(input_dict: dict) -> list: return [input_dict[x] for x in sorted(input_dict.keys())] +class SimulationResult: + def __init__(self, duration: float, energy: float, end_state, parameters): + self.duration = duration * 1e-6 + self.energy = energy * 1e-12 + self.end_state = end_state + self.parameters = parameters + self.mean_power = self.energy / self.duration + + class PTAAttribute: def __init__(self, value: float = 0, function: AnalyticFunction = None, value_error=None, function_error=None): self.value = value @@ -957,7 +966,7 @@ class PTA: param_dict = transition.get_params_after_transition(param_dict) state = transition.destination - return total_energy, total_duration, state, param_dict + return SimulationResult(total_duration, total_energy, state, param_dict) def update(self, static_model, param_model, static_error=None, analytic_error=None): for state in self.state.values(): -- cgit v1.2.3