From 1e84b8feb7f288fcc1e3f3d00458ea25276a552b Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 25 Mar 2019 15:09:35 +0100 Subject: _mean_std_by_param: Handle no partitions for attribute --- lib/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/utils.py b/lib/utils.py index 8b0eab5..64f1780 100644 --- a/lib/utils.py +++ b/lib/utils.py @@ -149,6 +149,9 @@ def _mean_std_by_param(by_param, state_or_tran, attribute, param_index, verbose vprint(verbose, '[W] parameter value partition for {} contains only one element -- skipping'.format(param_value)) else: vprint(verbose, '[W] parameter value partition for {} is empty'.format(param_value)) + if len(partitions) == 0: + vprint(verbose, '[W] Found no partitions for {}/{}/{} ???'.format(state_or_tran, attribute, param_index)) + return 0. return np.mean([np.std(partition) for partition in partitions]) def _corr_by_param(by_name, state_or_trans, attribute, param_index): @@ -170,9 +173,10 @@ def _all_params_are_numeric(data, param_idx): return True return False -class TimingAnalysis: +class OptionalTimingAnalysis: def __init__(self, enabled = True): self.enabled = enabled + self.wrapped_lines = list() self.index = 1 def get_header(self): @@ -193,6 +197,7 @@ class TimingAnalysis: for line in lines: if re.fullmatch('.+;', line): ret.append('TIMEIT( {:d}, {} )'.format(self.index, line)) + self.wrapped_lines.append(line) self.index += 1 else: ret.append(line) -- cgit v1.2.3